XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Tradeoffs of XML encoding by enclosing all contentin CDATA blocks

Karr, David a écrit :
> I pointed out to a client that they're seeing failures parsing XML 
> because some of the element content that they're producing contains 
> characters illegal in XML content, like "&" (unencoded).  They 
> acknowledged that should be fixed, but they also said they could instead 
> enclose all content with CDATA blocks.  That seems bizarre to me, but 
> I'm not sure I can immediately come up with all the cogent arguments 
> against that.  Can someone summarize specifically why you should NOT do 
> that?
> 

-because <![CDATA[&]]> is longer than &amp;
-because it will be deprecated in XML 2.0
-because your program use a specific XML profile that doesn't accept CDATA
-because it is one of the main cause of the global warming
-because they don't have to, since they are producing their data thanks 
to a program (I hope they don't use println to produce XML)

more seriously, I'm almost sure that they are using println or something 
similar to produce XML; this is why they get "&" and why they propose to 
correct by surrounding systematically content with CDATA; it's bad 
because the more often it will be useless and won't correct the problem 
in attributes

they should rely simply on an XML writer that can do the dirty job for 
them; if they used a template language, perhaps a setting that specify 
XML for the output might correct it

an XML writer is available in any language on any platform
for example:
http://java.sun.com/javase/6/docs/api/javax/xml/stream/package-summary.html

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS