Generating XML data |
|
After creating the required transfer template and optional DTD or XSD file, you are ready to generate an XML file using the data stored in the database.
The Run transfer function is most useful for testing the XTT. After you have created an XTT, you can use it to generate XML documents on demand and pass data to your XML application.
The following example shows a completed XTT template file and corresponding output file.
<?xml version="1.0"
encoding="US-ASCII"?>
<xtt:template xmlns:xtt="urn:schema-dbmaker-com:xml-template">
<root>
<CARD
xtt:query="CARD_SQL0" xtt:command="select NUM, FIRSTNAME, LASTNAME,
TITLE, BMP from SYSADM.CARD">
<NUM
xtt:textvalue="$CARD_SQL0.NUM" />
<FIRSTNAME
xtt:textvalue="$CARD_SQL0.FIRSTNAME" />
<LASTNAME
xtt:textvalue="$CARD_SQL0.LASTNAME" />
<TITLE
xtt:textvalue="$CARD_SQL0.TITLE" />
<BMP
xtt:textvalue="$CARD_SQL0.BMP" />
</CARD>
</root>
</xtt:template>
The corresponding output file for the preceding XTT file:
<?xml version="1.0"
encoding="US-ASCII" ?>
- <root>
- <CARD>
<NUM>1</NUM>
<FIRSTNAME>Eddie</FIRSTNAME>
<LASTNAME>Chang</LASTNAME>
<TITLE>Manager</TITLE>
<BMP>lobdir5\blobfile0.tmp</BMP>
</CARD>
- <CARD>
<NUM>2</NUM>
<FIRSTNAME>Hook</FIRSTNAME>
<LASTNAME>Hu</LASTNAME>
<TITLE>Software Engineer</TITLE>
<BMP>lobdir5\blobfile1.tmp</BMP>
</CARD>
</CARD>
- <CARD>
<NUM>7</NUM>
<FIRSTNAME>Oscar</FIRSTNAME>
<LASTNAME>Tseng</LASTNAME>
<TITLE>Software Engineer</TITLE>
<BMP>lobdir5\blobfile6.tmp</BMP>
</CARD>
- <CARD>
<NUM>8</NUM>
<FIRSTNAME>Jerry</FIRSTNAME>
<LASTNAME>Liu</LASTNAME>
<TITLE>Manager</TITLE>
<BMP>lobdir5\blobfile7.tmp</BMP>
</CARD>
</root>