CDATA Section Support (was RE: SAX2 RFD: LexicalHandler draft v.1.1)
David Megginson
david at megginson.com
Wed Mar 24 19:37:28 GMT 1999
Ronald Bourret writes:
> The obvious place where preservation of CDATA is important, then,
> is when I'm co-authoring a document with a friend who uses a
> DOM-based editor while I prefer a text editor. If every time my
> friend edits the document all the CDATA sections get wiped out,
> neither our friendship nor our co-authorship are going to last very
> long.
Yes, but there would be easier ways to handle this. Let's say, for
example, that you consistently use the following in your text editor:
<example><![CDATA[
<s>This is literal XML markup used as an example</s>
]]></example>
Now, if CDATA boundaries were discarded, when your friend loaded this
into her DOM-based editor and then saved it again, you would see
something like the following:
<example>
<s>This is literal XML markup used as an example.</s>
</example>
If this kind of thing does matter (as it probably would to you),
perhaps your friend could configure her editor to select certain
element types that would always have their content CDATA escaped on
export (nearly every document type has only one or two candidates,
such as HTML <pre>).
Even if your friend's editor didn't support that, nearly anyone on
this list could hack together a Perl or Java program in about 15
minutes that you allow you to do something like
xml-cdata-escape mydoc.xml example > mydoc2.xml
Voila, your CDATA is back! Of course, there are a few situations
where people use CDATA less predictably, but I hardly believe that the
requirement would survive a real cost-benefit analysis if the DOM WG
had made one.
All the best,
David
--
David Megginson david at megginson.com
http://www.megginson.com/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list