![CDATA[

J

Joseph Kesselman

I always see ![CDATA[ in XML page, what does this mean?

http://www.w3.org/TR/2006/REC-xml11-20060816/#sec-cdata-sect

What it really means is that whoever wrote the XML file was sloppy.
CDATA Sections are an ugly cluge intended to make manually
copy-and-pasting non-XML data into an XML file a little easier. The
proper solution is to use XML-aware tools, which will escape individual
characters when necessarily (and only when necessary).

If any tool actually requires the use of CDATA Sections rather than
escaping on a character-by-character basis, it's badly broken and should
be replaced.
 
R

Richard Tobin

Joseph Kesselman said:
What it really means is that whoever wrote the XML file was sloppy.
CDATA Sections are an ugly cluge intended to make manually
copy-and-pasting non-XML data into an XML file a little easier. The
proper solution is to use XML-aware tools, which will escape individual
characters when necessarily (and only when necessary).

However, it also makes the data more human-readable, which seems very
desirable when, for example, including a computer program in an XML
document.

-- Richard
 
J

Joseph Kesselman

Richard said:
However, it also makes the data more human-readable, which seems very
desirable when, for example, including a computer program in an XML
document.

Only if you're editing the document as XML source. If you're using an
XML-aware editing tool, the content is simply the content and is as
human-readable one way as the other. Escaping choices should be purely
an artifact of the datastream rather than of the document semantics, and
the user shouldn't have to look at them.
 
R

Richard Tobin

However, it also makes the data more human-readable, which seems very
desirable when, for example, including a computer program in an XML
document.
[/QUOTE]
Only if you're editing the document as XML source.

Which I often am. As the design goals for XML put it, "XML documents
should be human-legible and reasonably clear". XML is not just an
internal format.
Escaping choices should be purely
an artifact of the datastream rather than of the document semantics,
Yes...

and the user shouldn't have to look at them.

.... but I don't see how that follows. Escaping choices should not
affect document semantics, so they can be made for reasons such as
human convenience.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top