OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Is CDATA "structure"?

[ Lists Home | Date Index | Thread Index ]
  • From: Tom Otvos <tom.otvos@pervasive.com>
  • To: "'xml-dev@ic.ac.uk'" <xml-dev@ic.ac.uk>
  • Date: Thu, 15 Jul 1999 08:54:08 -0400

Hello all,
 
I was hoping that the general wisdom on this list might be able to help
settle a development debate we are having here.  In an app we are working
on, we are creating XML documents that have, as content to some elements,
HTML.  When writing out these documents, the elements which contain HTML
wrap their content in CDATA sections to avoid having to entity-encode all of
the angle brackets and ampersands.
 
Now, as product development progressed, we found that we wanted to preserve
the formatting of the HTML content, which required entity-encoding carriage
returns in the HTML so that the parser would return them correctly.
Naturally, the entity encodings had to appear outside of a CDATA section, so
the HTML elements were now broken up into many smaller CDATA sections,
separated by entity-encoded carriage returns.  
 
It was starting to look goofy, but it worked ok.  Then (just for fun) we
opened up our documents in a variety of XML editors (like IE5, which I know
is not an editor but it does display the structure).  To our surprise, the
CDATA sections were showing up in the structure, whereas the entity
encodings were silently converted.  A debate ensued as to whether or not
this was right, and whether or not our use of CDATA was "dumb".  The
proposed alternative was to skip CDATA altogether and just entity-encode the
HTML, making it virtually illegible in a text editor but very readable in an
XML editor.
 
So, my question is should CDATA sections in an XML document be considered
structural, and warrant being displayed in an XML editor, or should they be
considered more like "parser control" and be silently interpreted in the
same way that entity encodings are?  Although we cannot change the way the
current crop of XML editors behaves, it would be nice to know what the
conventional wisdom *thinks* should be happening.
Tom Otvos
Director of Research, Pervasive Software Inc.
"Try not! Do, or do not. There is no 'try'." - Yoda



xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@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@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS