Difference between revisions of "XML Overview"

From VistApedia
Jump to: navigation, search
 
Line 6: Line 6:
 
It's actually pretty simple. The tricky part, of course, is that certain characters must be represented as entities (i.e., encoded) within an XML document. Fortunately, there's a utility to do that for you. Without looking it up, I believe it's $$SYMENC<mrou>MXMLUTL</mrou>.
 
It's actually pretty simple. The tricky part, of course, is that certain characters must be represented as entities (i.e., encoded) within an XML document. Fortunately, there's a utility to do that for you. Without looking it up, I believe it's $$SYMENC<mrou>MXMLUTL</mrou>.
 
Having said that, the easiest way to get a WP field into an array is to call $$GET1^<mrou>DIQ</mrou>. You jusst then <mfunc>$ORDER</mfunc> through the array reading lines, encoding them and writing them out. For the reverse operation (taking text contained within an XML element and saving it in a WP field) the procedure depends on whether you're using the event driven (SAX) parser or <mrou>MXMLDOM</mrou>.
 
Having said that, the easiest way to get a WP field into an array is to call $$GET1^<mrou>DIQ</mrou>. You jusst then <mfunc>$ORDER</mfunc> through the array reading lines, encoding them and writing them out. For the reverse operation (taking text contained within an XML element and saving it in a WP field) the procedure depends on whether you're using the event driven (SAX) parser or <mrou>MXMLDOM</mrou>.
In the former case, you'll get one text event per line of text within the document (though the specification only says that you will receive SOME of the text without saying anything about how it's broken up). Keep track of the line number and save each line in an array. With MXMLDOM it's easier (of course): when you reach the element containing the text, just call TEXT<mrou>MXMLDOM</mrou> (if you know there's only one line, you can call it as an extrinsic). Anyway, this will copy the text into an array you pass by name, and that array can be used as an argument to <mentry>WP^DIE</mentry> to copy the text into a WP field.
+
 
 +
In the former case, you'll get one text event per line of text within the document (though the specification only says that you will receive SOME of the text without saying anything about how it's broken up). Keep track of the line number and save each line in an array. With MXMLDOM it's easier (of course): when you reach the element containing the text, just call TEXT<mrou>MXMLDOM</mrou> (if you know there's only one line, you can call it as an extrinsic). Anyway, this will copy the text into an array you pass by name, and that array can be used as an argument to <mentry>WP^DIE</mentry> to copy the text into a WP field.

Revision as of 16:29, 7 March 2005

General Description

XML is a variant of HTML used to transport information from one system to another.


Producing XML from MUMPS

It's actually pretty simple. The tricky part, of course, is that certain characters must be represented as entities (i.e., encoded) within an XML document. Fortunately, there's a utility to do that for you. Without looking it up, I believe it's $$SYMENC<mrou>MXMLUTL</mrou>. Having said that, the easiest way to get a WP field into an array is to call $$GET1^<mrou>DIQ</mrou>. You jusst then <mfunc>$ORDER</mfunc> through the array reading lines, encoding them and writing them out. For the reverse operation (taking text contained within an XML element and saving it in a WP field) the procedure depends on whether you're using the event driven (SAX) parser or <mrou>MXMLDOM</mrou>.

In the former case, you'll get one text event per line of text within the document (though the specification only says that you will receive SOME of the text without saying anything about how it's broken up). Keep track of the line number and save each line in an array. With MXMLDOM it's easier (of course): when you reach the element containing the text, just call TEXT<mrou>MXMLDOM</mrou> (if you know there's only one line, you can call it as an extrinsic). Anyway, this will copy the text into an array you pass by name, and that array can be used as an argument to <mentry>WP^DIE</mentry> to copy the text into a WP field.