XQuery changes <> to '&lt' and '&gt' during update node with CDATA XQuery changes <> to '&lt' and '&gt' during update node with CDATA oracle oracle

XQuery changes <> to '&lt' and '&gt' during update node with CDATA


CDATA does not replace anything. It is just an XML construct that let you write plain text, without having to escape the markup. This is only syntactic sugar, and is always equivalent to writing its content as text with the proper escaping. For instance:

<p><![CDATA[Use <p>Hello.</p> to write a paragraph.]]></p>

is always equivalent to:

<p>Use <p>Hello.</p> to write a paragraph.</p>

This can be useful sometimes, when you write an XML document by hand (like an article) containing a lot of markup in the text (like an article about XML, containing XML examples in the text).

Once parsed, CDATA is not "recorded" in any way. Once passed to an XQuery, both examples above will produce the exact same result (most likely, containing < escaped characters, if the text is copied to the output).