[xquery-talk] CDATA with computed constructors

Jens T Teubner teubner at us.ibm.com
Mon Feb 25 09:04:05 PST 2008

talk-bounces at x-query.com wrote on 02/25/2008 08:11:06 AM:

> I was trying to create a CDATA-section within an computed
> constructor. Therefore, i've read the relevant sections in the
> xquery spec, but I've found solution.

>From an XQuery Data Model point of view, CDATA sections and "regular" text
nodes are the same thing.  CDATA is just another representation for the
same value.  Hence, you can't express what you want in XQuery.

It shouldn't make any difference anyway.  The only advantage that a CDATA
section could have is that it might please your eyes.  Every XML Parser
should should handle a CDATA section the same way as its equivalent text
node representation.

But there may still be a way to get what you want.  The XQuery
Serialization specification suggests implementors to provide a
`cdata-section-elements' parameter, which may allow for a setting that
results in the output that you look for.  You'll first have to check though
whether your implementation supports the parameter at all.


Jens Teubner
IBM T.J. Watson Research Center
19 Skyline Drive, Hawthorne, NY 10532
+1 914 784 7179

More information about the talk mailing list