XML Output

From CometWiki

Jump to: navigation, search


XML stands for eXtensible Markup Language.

XML is a widely used scheme that allows data to be transmitted from one application to another without regard to how the applications were written.

In a way similar to Comma Delimited Files, XML files may be written using a modified Format statement.

! order line item file
OrderLine: Format _
"<order line>";_
olord$,  "order Number";_
ollin$,  "line Number";_
olitm$,  "item";_
olcode$, "bill code";_
oldsc$,  "description";_
olum$,   "unit of measure
olord,   "qty ordered";_
olshp,   "qty shipped";_
olbo,    "qty b/o";_
olprc,   "unit price";_
"</order line>"
File(LUN)XML        ! Write to this file in XML Format

Each XML data item (called an Entity), is composed of a name and a value. It looks like this: <name>value</name>. When indicated by the file statement above, Comet32 will treat a format statement differently than when specifying normal data output. The section of a format specification normally used for the edit mask is now treated as the item name. The item values are blank stripped and escaped according to XML specifications.

Items with no name fields are output literally. That gives you the ability to surround the data items in the format with a group name as illustrated above.

If the field is a string and it is empty, Comet will treat the item as an empty entity <name/>.

The Above format would output data something like this. The Carriage return/Line feeds were added for clarity.

<order line>
 <order Number>ORD123</order Number>
 <line Number>15</line Number>
 <bill code/>
 <description>Monkey Balls</description>
 <unit of measure>ea</unit of measure>
 <qty ordered>14</qty ordered>
 <qty shipped>10</qty shipped>
 <qty b/o>4</qty b/o>
 <unit price>4.50</unit price>
</order line>
Personal tools