[Bug 2441] xqx: character references

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2441





------- Comment #21 from davidc@nag.co.uk  2006-09-29 10:44 -------
(In reply to comment #19)

> David, it looks like in certain cases the XQueryX implementation
> should escape &.
> ..
> So, it doesn't seem to be a blind replace of &amp with & as suggested above

I'd assumed that your convertor was always double escaping and so removing one
level would fix it (it certainly fixes most) if your convertor is sometimes
double escaping and sometimes not, them clearly you only need to remove the
double escaping at those places where it was added.


> 
> For example:
> 
> <!--<?&-&lt;&#x20;><![CDATA[x]]>-->
> 
> Is currently correctly encoded as:
> 
>  <xqx:value>&lt;?&amp;-&lt;&amp;#x20;&gt;&lt;![CDATA[x]]&gt;</xqx:value>
> 

that encoding is incorrect.

Given the XQuery

<!--<?&-&lt;&#x20;><![CDATA[x]]>-->

xq2xqx produces


<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX">
   <xqx:mainModule>
      <xqx:queryBody>
         <xqx:computedCommentConstructor>
            <xqx:argExpr>
               <xqx:stringConstantExpr>
                 
<xqx:value>&lt;?&amp;-&amp;lt;&amp;#x20;&gt;&lt;![CDATA[x]]&gt;</xqx:value>
               </xqx:stringConstantExpr>
            </xqx:argExpr>
         </xqx:computedCommentConstructor>
      </xqx:queryBody>
   </xqx:mainModule>
</xqx:module>

which when processed with the standard stylesheet produces

 comment{"&lt;?&amp;-&amp;lt;&amp;#x20;>&lt;![CDATA[x]]>"}

which is an equivalent query, both produce the XML

<!--<?&-&lt;&#x20;><![CDATA[x]]>-->

If however the xqx:value-of element is replaced by the element that you
suggested, then the standard xqueryx stylesheet produces

 comment{"&lt;?&amp;-&lt;&amp;#x20;>&lt;![CDATA[x]]>"}

which is not an equivalent query, when executed it produces
<!--<?&-<&#x20;><![CDATA[x]]>-->


which is an entirely different XML comment.



David

Received on Friday, 29 September 2006 10:44:58 UTC