XML Output
From CometWiki
m (minor) |
(results added) |
||
Line 15: | Line 15: | ||
OrderLine: Format _ | OrderLine: Format _ | ||
"<order line>";_ | "<order line>";_ | ||
- | olord$, "order Number";_ | + | olord$, "order Number";_ |
- | ollin$, "line Number";_ | + | ollin$, "line Number";_ |
- | olitm$, "bill code";_ | + | olitm$, "item";_ |
- | oldsc$, "description";_ | + | olcode$, "bill code";_ |
- | olum$, "unit of measure | + | oldsc$, "description";_ |
- | olord, "qty ordered";_ | + | olum$, "unit of measure |
- | olshp, "qty shipped";_ | + | olord, "qty ordered";_ |
- | olbo, "qty b/o";_ | + | olshp, "qty shipped";_ |
- | olprc, "unit price";_ | + | olbo, "qty b/o";_ |
+ | olprc, "unit price";_ | ||
"</order line>" | "</order line>" | ||
... | ... | ||
Line 40: | Line 41: | ||
If the field is a string and it is empty, Comet will treat the item as an empty entity '''<name/>'''. | 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> | ||
+ | <item>mb01</item> | ||
+ | <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> | ||
</td> | </td> | ||
</table> | </table> |
Latest revision as of 18:56, 17 May 2010
Introduction
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.
Syntax: |
! ! 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 ... Write(LUN,OrderLine) |
Discussion: |
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> <item>mb01</item> <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> |