[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
- From: Rick Jelliffe <rjelliffe@allette.com.au>
- To: xml-dev@lists.xml.org
- Date: Tue, 30 Sep 2008 19:49:42 +1000
Karr, David wrote:
>
> 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?
>
I think you are getting the cart before the horse.
All CDATA sections do is give you an alternative mechanism for delimiting.
What you need to consider is not what is better to use in the general
case, but what is easier to use in *your* specific case.
That is really what matters: it is an issue of pragmatics not
theoretics. If it is easier for them to use CDATA sections, let
them use CDATA sections! You say tomato and they say tomato, lets call
the whole thing WF!
And usually the difference is only relevant in some odd cases: in
particular if you are reading or writing the
XML with non-XML-aware tools, where you have to rely on a particular
form of the text rather than the XML markup.
These systems still exist, but much less so than in the early XML days
of the Desperate Perl Hacker.
Almost the only general thing we can say about CDATA marked sections is
that they make even less justifiable to
ever generate non-well-formed XML or to arbitrarily limit the characters
available due to some programming inconvenience
issue. And that, where for some reason the XML text cannot be delimited
properly inline, they reduce the chance of WF
errors.
Cheers
Rick
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]