The genxmlqueryhdr() and genxmlqueryhdrclob() XML functions
Returns the result set of a query in XML with the XML header.
Purpose
These
functions are exactly the same as genxmlquery() and genxmlqueryclob(),
except they include an XML header. An XML header specifies document
properties such as the document encoding, the document type definition
(DTD), and XML stylesheet (XSL). The following example shows a typical
XML header:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Server SYSTEM "opt/pdos/etc/pdoslrd.dtd">
The encoding that is returned is the same as that of the operating system.
The genxmlqueryhdr() syntax
The genxmlqueryhdrclob() syntax
Parameters
- row
- The rows and columns to return
- query
- The SQL query whose result set will be returned as an XML document with a header.
Example 1
EXECUTE FUNCTION genxmlqueryhdr('manufact_set','SELECT * FROM manufact');
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE manufact_set SYSTEM "../manufact_set.dtd">
<?xml-stylesheet type="text/xsl" href="../manufact_set.xsl" ?>
<manufact_set>
<row>
<manu_code>SMT</manu_code>
<manu_name>Smith </manu_name>
<lead_time>3</lead_time>
</row>
<row>
<manu_code>ANZ</manu_code>
<manu_name>Anza </manu_name>
<lead_time>5</lead_time>
</row>
<row>
<manu_code>NRG</manu_code>
<manu_name>Norge </manu_name>
<lead_time>7</lead_time>
</row>
<row>
<manu_code>HSK</manu_code>
<manu_name>Husky </manu_name>
<lead_time>5</lead_time>
</row>
</manufact_set>