XML Output

From CometWiki

Revision as of 17:38, 17 May 2010 by Jim (Talk | contribs)
Jump to: navigation, search

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$, "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 above.

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


Personal tools