xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sita P.R.S." <sita_...@adforce.com>
Subject RE: question about embedded data in XML
Date Fri, 03 Nov 2000 18:45:44 GMT
If you look at the XML 1.0 spec, it says :
"The ampersand character (&) and the left angle bracket (<) may appear in
their literal form only when used as markup delimiters, or within a comment,
a processing instruction, or a CDATA section. If they are needed elsewhere,
they must be escaped using either numeric character references or the
strings "&amp;" and "&lt;" respectively. The right angle bracket (>) may be
represented using the string "&gt;", and must, for compatibility, be escaped
using "&gt;" or a character reference when it appears in the string "]]>" in
content, when that string is not marking the end of a CDATA section......."

But it also says...
"In a CDATA section, character data is any string of characters not
including the CDATA-section-close delimiter, "]]>"....
CDATA sections cannot nest."

Thus if you have a CDATA section within a CDATA section, it will not conform
to this spec


-----Original Message-----
From: Mark Shacklette [mailto:jmshack@home.com]
Sent: Friday, November 03, 2000 6:04 AM
To: general@xml.apache.org
Cc: tpassin@mitretek.org
Subject: Re: question about embedded data in XML

And this is I suppose the question, because what happens in the case that
CDATA section itself includes XML, and to really get at it, what if that
enclosed XML itself includes multiple CDATA section.  Which CDATA closure
operate?  Or am I missing something?

the point is this:  Will Xerces parsers correctly work with something like
following (pardon if it's not exacly correct, but you get the idea...):

<foo><! [CDATA[<embeddedXML><! [CDATA[hello]]></embeddedXML>]]></foo>

Thanks for any and all help or suggestions.

> Mark Shacklette
> > We have a need to embed the following types of information in an XML
> document:
> >
> > strings that themselves contain XML (which we DON'T want parsed)
> > strings that themselves contain HTML (which we also don't want parsed)
> > encoded data that may be binary data encoded which could contain
> > (which we also don't want parsed).
> >
> > Does anyone have any recommendations on XML best practices to handle
> the above
> > data needs?
> >
> This is what CDATA sections are for.  Binary data should be base-64
> encoded, then put into a CDATA section.
> Tom Passin

In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message