|
Hi David,
Firstly, the parser should not parse the content of a CDATA block. That doesn't mean it wont though. You are at the mercy of the implementation and they are not all standard. Anybody who has had to talk to many SOAP servers learns this lesson quickly.
See http://www.w3schools.com/xml/xml_cdata.asp for some details confirming your belief.
Secondly, when escaping entities yourself there are a few characters to watch out for - not just the ampersand (&):
Certain characters are reserved because they form the structure of the markup language. they are<>'".
To escape them they are replaced by representations:
< goes to<
goes to>' goes to'
" goes to"
Because the escaped representations begin with an ampersand (&) that character is now also reserved! So we have to escape it too:
& goes to&
If you want to escape the characters yourself NEVER escape the ampersand last because escaping all the others introduces new ampersands into the markup and you want to leave those ones alone.
Finally, why work this out yourself? Use an open source tool to do this. Henrik has built a good one, and you can download mine at http://sourceforge.net/projects/xmli/files/ They're free and much used.
Cheers
Larry Ducie
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.