[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CDATA sections in W3C XML Infoset
- From: Richard Lanyon <rgl@decisionsoft.com>
- To: Richard Tobin <richard@cogsci.ed.ac.uk>
- Date: Wed, 28 Mar 2001 12:51:34 +0100 (BST)
On Wed, 28 Mar 2001, Richard Tobin wrote:
> (b) They are purely syntactic sugar. Nothing (except an editor or similar)
> should treat the following differently:
>
> AT&T is a large corporation
> <![CDATA[AT&T]]> is a large corporation
> <![CDATA[AT&T is a large corporation]]>
> > I was hoping to use the Infoset in writing the spec for XML Script
> Did you intend to give variants like those in (b) different meanings
> in XML Script?
The problem is that the obvious way to implement XML Script is on top
of a DOM of some kind. The DOM will hold the three variants given
above differently. Now, it's comparatively easy to "pretend" there's
just a single block of text there if you're in a read-only situation
(a la XSLT), but if you're in a read-write situation (like XML
Script), then you have to invent "fake" text nodes to hold a value
that crosses DOM node boundaries. It quickly gets a bit nightmarish.
While I admit that CDATA sections are just syntactic sugar, there
isn't any way to tell a DOM to automatically convert all its CDATA
sections to text nodes other than physically looping through the tree
and converting them yourself. You could do it at parse time, but that
assumes you have control of the parser, which isn't necessarily the
case.
--
Richard Lanyon, Software Engineer DecisionSoft Ltd.
Telephone: +44-1865-203192 http://www.decisionsoft.com
"The medium is the message" -- Marshall McLuhan