xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Why won't XOM let you create a CDATA section?
- From: Tatu Saloranta <cowtowncoder AT yahoo.com>
- To: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Why won't XOM let you create a CDATA section?
- Date: Tue, 22 Aug 2006 11:46:13 -0700 (PDT)
--- Lance Eason <leason AT betweenmarkets.com> wrote:
...
> and not breaking a number of existing unit tests but
> I can make
> secondary arguments for encoding/decoding
> performance for large text
> values and resulting document size when (as in my
> case) there are a
> large number of characters that will end up encoded.
While CDATA is a perfectly legal xml construct to use
(from xml specification perspective), as a parser
writer I wish it was never included in xml (from
sgml), mostly because it has a few problems.
One is the obvious problem of not being able to embed
"]]>" in section (as there's no quoting mechanism),
but more importantly, due to missing a quoting
mechanism, you are fully limited by the character
encoding in use. In regular character content one can
use character entities to encode any legal xml
character: so for example unless you want non-latin1
characters in names, it's usually fine to use latin1
encoding for content -- if there are other unicode
characters, they can be escaped. This is not possible
with CDATA.
Also, since CDATA looks like a directive, it
complicates text normalization (coalescing) quite a
bit: one has to do look-ahead for actual next token
type to see whether there is more text to come.
This is obviously nothing user needs to worry about,
but it reduces efficiency of streaming parsers that
need to be able to coalesce all text (specifically,
Stax parsers).
Just my 2c,
-+ Tatu +-
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-
[XOM-interest] Why won't XOM let you create a CDATA section?,
Lance Eason, 08/22/2006
- Re: [XOM-interest] Why won't XOM let you create a CDATA section?, Elliotte Harold, 08/22/2006
-
Re: [XOM-interest] Why won't XOM let you create a CDATA section?,
Tatu Saloranta, 08/22/2006
- Re: [XOM-interest] Why won't XOM let you create a CDATA section?, Elliotte Harold, 08/22/2006
- <Possible follow-up(s)>
-
Re: [XOM-interest] Why won't XOM let you create a CDATA section?,
Lance Eason, 08/22/2006
- Re: [XOM-interest] Why won't XOM let you create a CDATA section?, Elliotte Harold, 08/22/2006
- Re: [XOM-interest] Why won't XOM let you create a CDATA section?, Elliotte Harold, 08/28/2006
Archive powered by MHonArc 2.6.24.