This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: parsing XML string that consists of special character
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] parsing XML string that consists of special character
- From: Olga Tubman <olga at mercury dot co dot il>
- Date: Wed, 21 Mar 2001 11:06:28 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
Rick,
Thank you for your answer,
but i tried to use the second possibility (with CDATA)
and it isn't work. Do you have some idea why it can
happen.
Thank you, Olga
-----Original Message-----
From: RSuiter@cccis.com [mailto:RSuiter@cccis.com]
Sent: Tuesday, March 20, 2001 5:53 PM
To: xsl-list@lists.mulberrytech.com
Subject: Re: [xsl] parsing XML string that consists of special character
Olga,
>I have XML string that can consist of characters like <,>,&
If your strings contain < or &, then they aren't xml, because these
characters are reserved for special use in xml (namely as the beginning of
a tag and the beginning of an entity name, respectively). Therefore, you
will have to preprocess your strings before you can parse it using xml or
xslt.
There are three options:
"escape" all the < and & characters by replacing them with < and
& respectively (note, the semi-colons are part of the replacements).
enclose the fields you pull from the database in so-called CDATA tags,
which are <!CDATA[ at the beginning and ]]> at the end. This will work
except for the unusual case where your data contains ]]> anywhere.
disable-output-escaping (very rarely necessary, and usually a sign of
insufficient understanding of the original problem).
This is a widely discussed problem, both on this list and elsewhere.
Rick Suiter
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list