Using the xmlda_flags

From InterBase
Jump to: navigation, search

Go Up to Using the InterBase API to Generate XML


The following are examples of how to use XMLDA_ATTRIBUTE_FLAG and XMLDA_NO_HEADER.


XMLDA_ATTRIBUTE_FLAG

Setting the XMLDA_ATTRIBUTE_FLAG outputs the data as attributes rather than elements. This flag affects only the actual data generated from InterBase. All other tags can be controlled by inputting the desired attributes as tags. If this flag is set, the XML file is be generated as follows:

<?xml version="1.0"?>
<!-- Example XML from IB (smistry) -->
<Employee_DB>
<PhoneList>
<Employee>
<LAST_NAME="Bender">
<FIRST_NAME="Oliver H.">
<PHONE_EXT="255">
</Employee>
<Employee>
<LAST_NAME="Bishop">
<FIRST_NAME="Dana">
<PHONE_EXT="290">
</Employee>
…
…
<Employee>
<LAST_NAME="Young">
<FIRST_NAME="Katherine">
<PHONE_EXT="231">
</Employee>
</PhoneList>
</Employee_DB>


XMLDA_NO_HEADER

Setting the XMLDA_NO_HEADER flag suppresses the header. In our example, the generated XML file would look as follows:

<Employee>
<LAST_NAME>Bender</LAST_NAME>
<FIRST_NAME>Oliver H.</FIRST_NAME>
<PHONE_EXT>255</PHONE_EXT>
</Employee>
<Employee>
<LAST_NAME>Bishop</LAST_NAME>
<FIRST_NAME>Dana</FIRST_NAME>
<PHONE_EXT>290</PHONE_EXT>
</Employee>
…
…
<Employee>
<LAST_NAME>Young</LAST_NAME>
<FIRST_NAME>Katherine</FIRST_NAME>
<PHONE_EXT>231</PHONE_EXT>
</Employee>
}

Advance To: