Difference between revisions of "XML Overview"
DavidWhitten (talk | contribs) |
|||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
=== General Description === | === General Description === | ||
− | XML is a | + | XML (Extensible Makup Language) is becoming widely used as a system independent representation of data for transport from one system to another. It is derived from SGML (Standard General Markup Language). XHTML is a variant of HTML that has been made to conform to the more rigid syntax of XML. |
− | |||
=== 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 $$<mentry>SYMENC^MXMLUTL</mentry>. | 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>. | + | Having said that, the easiest way to get a WP field into an array is to call $$<mentry>GET1^DIQ</mentry>. You jusst then [[MUMPS Functions $ORDER|$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. | 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. |
Latest revision as of 00:04, 7 July 2012
General Description
XML (Extensible Makup Language) is becoming widely used as a system independent representation of data for transport from one system to another. It is derived from SGML (Standard General Markup Language). XHTML is a variant of HTML that has been made to conform to the more rigid syntax of XML.
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.