Round-trip issues

keshlam at keshlam at
Thu Mar 25 16:47:41 GMT 1999

Gathering and replying to several comments:

>By the same argument,
> <p
> x="1">
> <p x="1">
> are different, because the author used them.

The concept of ignorable whitespace also permits individual applications to
_not_ ignore it, I believe.

>Again, is anyone aware of why CDATA is preserved by the DOM?

CDATA exists in the first place because some folks are working with applications
that are displeased by having to juggle character-entity references when
representing textual data that conflicts with XML syntax. Consider an XML editor
which is creating an XHTML page with embedded dynamic scripting. One can argue
that outputting a<b in that script code as a&lt;b ought to be fine, since the
browser's parser should convert it back before handing the code off to the
interpreter. On the other hand, it adversely affects human-readability of the
XML file. And part of the point of using XML rather than binary representations
is that the files should be reasonably human-readable.

If you don't like it, you can ignore it; in an OO language, the DOM makes
CDATASection a subclass of Text; you can simply treat it as Text and never know
the difference. But when you write the file back out, it will still be in the
CDATA wrapper, unless you explicitly take action to defeat that.

Much of this is the "source-level debugging problem" applied to data. It's
generally a bad idea to unconditionally discard human-generated information
unless you _know_ it will never be meaningful to any downstream processing
stage. It's fine for applications to request that it be discarded, or discard it
themselves; they have enough information to do so. Support routines should be
able to pass data through unchanged unless configured or instructed to do

Joe Kesselman  / IBM Research
Unless stated otherwise, all opinions are solely those of the author.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list