db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Army <qoz...@gmail.com>
Subject Re: XMLPARSE/XMLSERIALIZE question
Date Tue, 29 Aug 2006 16:30:58 GMT
Daniel John Debrunner wrote:
> I insert an XML document into an XML column using XMLPARSE (with 10.2)
> and select it using XMLSERIALIZE. The raw input to the XMLPARSE had as
> its first line:
> 
> <?xml version="1.0" encoding="utf-8" ?>
> 
> I don't see that being generated when I select it with XMLSERIALIZE, is
> that expected?

Short answer: Yes, that's expected, and is covered by the documentation here:

http://db.apache.org/derby/docs/dev/ref/rreffuncxmlserialize.html

<begin quote>

Attention: Serialization is performed based on the SQL/XML serialization rules. 
These rules, combined with the fact that Derby supports only a subset of the 
XMLSERIALIZE syntax, dictate that the results of an XMLSERIALIZE operation are 
not guaranteed to be in-tact copies of the original XML text.

<end quote>

Longer answer:

Since the XMLSERIALIZE operator doesn't currently support the DOCUMENT nor 
CONTENT keywords, SQL/XML spec says that the default is CONTENT (6.7:Syntax 
Rules:2.a).  Further, since the XMLSERIALIZE operator doesn't currently support 
the <XML declaration option> syntax, the SQL/XML spec says that the default for 
that option is "Unknown" (6.7:General Rules:2.f).  Put those together and that 
in turn means that the value of "OMIT XML DECLARATION" must be "Yes", as stated 
in section 10.15:General Rules:8.c.  So we omit the XML declaration when we 
serialize an XML document in Derby.

Army


Mime
View raw message