Navigation: Templates > Guide to all Templates > Code Templates >====== Import From XML code template ====== | |
The Import From XML code template is used to read the contents of an external XML into a valid target destination. This code template is actually a wrapper around the built-in class library support for XML parsing.
The following prompts are provided:
Import File | Press the ellipsis button to select a valid XML source file to import. If you wish to select this file name at runtime, check the Select import file at runtime check box. You may also specify a variable here (Example: !FilenameVariable). |
Mapping File | Press the ellipsis button to select a valid XML mapping file to use during import. In Clarion terms, mapping refers to associating an XML tag or schema to a database column name. If you wish to select this file at runtime, check the Select mapping file at runtime check box. You may also specify a variable here (Example: !FilenameVariable). |
Destination | Press the ellipsis button to select a valid label of a GROUP, FILE, VIEW or QUEUE to hold the contents of the import XML file. |
XML Style | Select Tag-based or Attribute-based. This setting controls the XML formatted output style. |
Example ' Tag based output:
<;?xml version=“1.0” ?>
- <;dataroot>
- <;Table>
<;id>1<;/id>
<;firstname>Fred<;/firstname>
<;lastname>Flintstone<;/lastname>
<;gender>M<;/gender>
<;/Table>
Example ' Attribute based output:
<;?xml version=“1.0” ?>
- <;dataroot>
<;row id=“1” firstname=“Fred” lastname=“Flintstone” gender=“M” />
<;row id=“2” firstname=“Andrew” lastname=“Guidroz” gender=“M” />
<;row id=“4” firstname=“Gavin” lastname=“Holiday” gender=“M” />
<;row id=“35” firstname=“Hello” lastname=“There” gender=“f” />
<;/dataroot>
For more information, please review the Clarion XML Support Reference Guide PDF file included in your install.