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: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] 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,

-- 
Florent Georges
http://fgeorges.org/



      

_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to