Difference between revisions of "XML Overview"
Line 4: | Line 4: | ||
=== Producing XML from MUMPS === | === 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 $$ | + | 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 $$<mentry>SYMENC^MXMLUTL</mentry>. |
− | Having said that, the easiest way to get a WP field into an array is to call $$GET1^ | + | Having said that, the easiest way to get a WP field into an array is to call $$<mentry>GET1^DIQ</mentry>. You jusst then $ORDER 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 | + | 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 <mentry>TEXT^MXMLDOM</mentry> (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 23:08, 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 $$<mentry>SYMENC^MXMLUTL</mentry>. Having said that, the easiest way to get a WP field into an array is to call $$<mentry>GET1^DIQ</mentry>. You jusst then $ORDER 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 <mentry>TEXT^MXMLDOM</mentry> (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.