Project

Profile

Help

XML declaration in XQuery

Added by Anonymous over 15 years ago

Legacy ID: #5522029 Legacy Poster: Jesper Tverskov (jesper_tverskov)

When I do an XQuery in Saxon 9.1.0.3 an XML declaration is added to output. That is not the case in 9.0.0.2 or in AltovaXML or in DataDirect. Is this XML declaration a bug or something better? Jesper Tverskov


Replies (1)

RE: XML declaration in XQuery - Added by Anonymous over 15 years ago

Legacy ID: #5522650 Legacy Poster: Michael Kay (mhkay)

The XML declaration is present in the output both in 9.0 and in 9.1 (and as far as I'm aware, in previous releases) when a query is run from the command line. There may be ways of running a query where the default serialization has changed, but you'll then have to tell us how you are running the query. It's possible I changed some interface to align it with other interfaces. The W3C XQuery specification is not prescriptive about serialization formats; it allows each implementation to define its own defaults. (see http://www.w3.org/TR/xquery/#id-xq-serialization-parameters). Although it's true that an XML document in UTF-8 (which is the default encoding) doesn't absolutely need an XML declaration, I think it's good practice to have one, to minimize the risk of software (or people) subsequently reading the file and assuming the wrong encoding. If you don't want the XML declaration it's easy enough to suppress it using the omit-xml-declaration parameter.

    (1-1/1)

    Please register to reply