Eric,
. Whether you use xdmp:quote or the CDATA markers you'd need to use
xdmp:unquote when pulling the data out. However it's worthwhile mentioning
that if your use case is an RSS feed every reader that I've used does all
the necessary lifting to properly render the HTML.
As Norm mentioned using the CDATA markers is really just an escaping
mechanism and so the presence of those markers should not be relied upon for
processing purposes.
Running the below through CQ should help to illustrate this, I'm going to
recommend using the text button when you run this so you see how the content
is escaped:
xdmp:document-insert("/TEST.XML", <a><![CDATA[<empty-node/>]]></a>),
xdmp:document-insert("/TEST1.XML", <a>{xdmp:quote(<empty-node />)}</a>)
;
xdmp:quote(<empty-node />),
fn:data(fn:doc("/TEST.XML")/a),
fn:data(fn:doc("/TEST1.XML")/a)
Hope this helps.
-fs
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Eric
Palmitesta
Sent: Tuesday, September 02, 2008 12:21 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Preserving CDATA in Mark Logic
If one were to go the xdmp:quote route, would they need to remember to
unquote when pulling the data out?
While working with xquery and marklogic for the last month, I actually
haven't seen any CDATA regions at all, I'm assuming ML is doing some
automatic management here?
Eric
Frank Sanders wrote:
> Vasu,
>
> You can either make the insertion as you mentioned below or you can
> call xdmp:quote on the html you wish to store as CDATA.
>
> -fs
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Sakthikumar,
> Vasu
> Sent: Tuesday, September 02, 2008 11:19 AM
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] Preserving CDATA in Mark Logic
>
> Norm,
>
> Thanks for the reply. I might need to store pre-formatted html in a
> CDATA section.
>
> Thanks
>
> Vasu
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Norman
> Walsh
> Sent: Tuesday, September 02, 2008 11:14 AM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Preserving CDATA in Mark Logic
>
> "Sakthikumar, Vasu" <[EMAIL PROTECTED]> writes:
>
>> I tried inserting an XML document with CDATA, but the CDATA is not
>> preserved.
>>
>> Here's the query I ran.
>>
>> xdmp:document-insert('/TEST.XML', <a><![CDATA[test_cdata]]></a>)
>>
>> How do I preserve CDATA in the XML?
>
> What's your motivation for preserving the CDATA markers? A CDATA section
> is really just an escaping mechanism in the serialization.
>
> Be seeing you,
> norm
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
