XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Alexander JitegSubject: 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"?

Thanks
Alex

Posttop
Minollo I.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"?>

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.