Re: [XQueryX] 5 A Trivial Embedding of XQuery

> Although interesting, none of your comments are specific to XQuery.

I believe that they are as there is a suggestion that the bits of Xquery
that _look_ like XML can be inlined into the XML as XML (in particular
an XML query heavy with literal element constructors might be inlined as
an element tree).

If you put a string which is xpath or tex or sgml or anything else into
xml then yes you have to quote things according to xml rules but you
just unquote them on the way back and you know where you are.

It is the suggestion that sometimes you need to do that and sometimes
you don't that makes this problematic.



> Also, embedding XQuery queries by wrapping them with CDATA sections clearly
> doesn't work when a query contains the sequence ]]>

You can't put the sequence ]]> in an XML file anyway it's not just that
you can't wrap a CDATA section around it, that sequence isn't legal
anywhere (except ending a cdata section.

An embedding of xquery into XML that is safe and reversible is
replace each of < & and > by &lt; &amp; &gt; place resulting string in
XML element.
Extract element content (not its linearisation) and parse as Xquery.

That is essentially what you do for Xpath anyway. The danger is the
suggestion that unless there are < being used as < (rather than element
constructors) the Xquery can be directly placed in the XML.

David


-- 
http://www.dcarlisle.demon.co.uk/matthew

Received on Wednesday, 14 January 2004 15:12:57 UTC