Subject:Adding the XML header to an output Author:Alexander Jiteg Date:26 Apr 2007 05:14 AM
Hi,
How can I add the <?XML ...?>-header to an Xquery output? If I add it in my XQuery source I get an error telling me that "A processing instruction must not be named 'xml' in any combination of upper and lower case"?
Subject:Adding the XML header to an output Author:Minollo I. Date:28 Apr 2007 09:37 AM
Suppose you want to generate the following XML document,
<?xml version="1.0"?>
<e/>
Simply executing the following query doesn't do it,
<e/>
Trying to get the appropriate result by adding the xml declaration to the query causes the following error (using DataDirect XQuery, for example):
[DataDirect][XQuery][err:XPST0003]Error at line 1, column 3. Processing instruction target "xml" is reserved.
As XQuery specifies, the PITarget of a processing instruction may not consist of the characters "XML" in any combination of upper and lower case.
In order to get the XML declaration in the query result, one need to disable the omit-xml-declaration serialization parameter.
For example, you can do the following:
declare option ddtek:serialize "omit-xml-declaration=no";
<e/>
It yields the expected result:
<?xml version="1.0"?>