Eddie Shipman wrote:
> <SNIP>
>> But my problem is that I want to write CRLF par as "
> " to avoid
>> having the CRLF written as is in the XML document (I find it more
>> readable
>> to have the CRLF encoded).
>>
>> How can I tell TXMLDocument to write the ampersand ("&") without
>> escaping it?
>
> Enclose it in a CDATASection.

Enclose what? Do you envision something like this?

<node>x<![CDATA[&#13;&#10;]]>y</node>

That is identical to this:

<node>x&amp;#13;&amp;#10;y</node>

That's not what Francois wants. He wants this:

<node>x&#13;&#10;y</node>

The XML serializer, though, doesn't normally bother with character
entities for normal printable characters like carriage return and line
feed. Instead, it outputs this:

<node>x
y</node>

Of, it you explicitly added a CDATA section to the document tree, it might
output this:

<node>x<![CDATA[
]]>y</node>

I don't usually see XML serializers that bother generating CDATA sections.
Instead, they just use character entities to encode whatever characters
aren't in the output encoding. If the output encoding is UTF-8 or UTF-16,
then nothing gets encoded except ampersand, greater-than, less-than, and
apostrophe.

-- 
Rob


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to