IBM® Informix® 12.10

XML publishing

XML publishing provides a way to transform results of SQL queries into XML structures.

When you publish an XML document using the built-in XML publishing functions, you transform the result set of an SQL query into an XML structure, optionally including an XML schema and header. You can store the XML in the database server for use in XML-based applications.

The input XML must be in nested elements within an XML document, with each column being an XML element rather than an attribute. This format is sometimes called the FOR XML AUTO, ELEMENTS format.

The genxmlschema function and other XML publishing functions cannot publish BYTE or TEXT columns into an XML document. These functions take the input column as ROW types and then publish them. BYTE and TEXT are not allowed in ROW types, so cannot be used in these publishing functions.

ROW types are unsupported in distributed queries. These functions use ROW types. As a result, these publishing functions cannot be used in distributed queries or use a synonym referring to a non-local object.

Before you run XML functions, run the following statement to allow multiple lines:
EXECUTE PROCEDURE ifx_allow_newline('t'); 
Run the following statements on the database server before running the examples in this book. The CREATE DATABASE statement uses a dbspace named datadbs. You must either create a dbspace named datadbs or substitute datadbs with the name of an existing dbspace.
EXECUTE PROCEDURE ifx_allow_newline('t');
CREATE DATABASE demo_xml IN datadbs with log;
CREATE TABLE tab (col2 lvarchar);
INSERT INTO tab VALUES ('
	<personnel>
		<person id="Jason.Ma">
		<name>
		  <family>Ma</family>
  		<given>Jason</given>
		</name>
		</person>
	</personnel>');


Send feedback | Examples exchange | Troubleshooting

To find the PDF, see Publications for the IBM Informix 12.10 family of products.
For the release notes, documentation notes, and/or machine notes, see the Release Notes page.
timestamp Release date: March 2013