Actually, the situation is a little more subtle than that.  1.0-ml  
recognizes certain
HTML entities in the *XQuery* parser.  The XML parser operates under the  
same
rules in both places.

So if foo.xml contains
<p>&copy;</p>

xdmp:document-get("foo.xml")
will throw the invalid entity error in either dialect.

You also have to be careful about any such tests performed in CQ
as CQ is performing its own manipulations of the input query
before executing it inside an xdmp:eval, to say nothing of the fact
that a browser is involved, which brings in its own manipulations
of the input and output.

//Mary

On Tue, 22 Jun 2010 11:52:21 -0700, Danny Sokolsky  
<[email protected]> wrote:

> Hi Keith,
>
> I think in the 1.0-ml dialect that MarkLogic automatically recognizes  
> the html entities.  In the 1.0 (strict) dialect, you would need to both  
> add an entity reference and escape the & in your xquery.  Something like  
> (using 4.1-6):
>
> xquery version "1.0-ml";
> declare namespace xdmp="http://marklogic.com/xdmp";;
> let $x := '
> <p>This is a &copy; symbol.</p>'
> return
> xdmp:unquote($x)
>
> => <p>This is a © symbol.</p>
>
> and:
>
> xquery version "1.0";
> declare namespace xdmp="http://marklogic.com/xdmp";;
> let $x := '<!DOCTYPE [<!ENTITY copy "&#169;">]>
> <p>This is a &amp;copy; symbol.</p>'
> return
> xdmp:unquote($x)
>
> => <p>This is a © symbol.</p>
>
> -Danny
> -----Original Message-----
> From: [email protected]  
> [mailto:[email protected]] On Behalf Of Florent  
> Georges
> Sent: Tuesday, June 22, 2010 9:40 AM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] xdmp:unquote() and invalid entity  
> reference exception...
>
> Keith L. Breinholt wrote:
>
>   Hi,
>
>> I’ve looked through the document and it is referring to the
>> &copy; html entity.  However, this is a valid HTML entity, so
>> why is it throwing this exception
>
>   But XML is not HTML.  And those entities are not "pre-declared"
> in any way.  So I expect that to fail.  But actually when I try
> to reproduce this based on the partial example you provided, I
> get it working:
>
>     xdmp:unquote("<p>&copy;</p>", "", ("format-xml", "repair-none"))
>
> gives the following when evaluated through CQ:
>
>     <p>©</p>
>
>   Regards,
>


_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to