in reply to XML::Simple and problem characters
The &foo; syntax has special meaning in XML. However, unlike HTML, XML does NOT predefine a bunch of named enties. So, if the entity has not been declared first, the XML parser won't know what it is. The only exceptions to these entities are > < & " ' and those in the form of 
 etc.
If you want to preserve the entity verbatim, you probably want to do this:
$xml =~ s/&(?!gt;|lt;|amp;|quot;|apos;|#x\d+;)/&/g;
Basically, you are properly escaping all of the & that should not be in the XML. So &simple; would become &simple; (boy this is hard to type in HTML).
Sorry, the code is untested, but should work ;-)
Update: Added the ; in the regex to make it a little more correct.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simply Choking
by ChemBoy (Priest) on Feb 08, 2005 at 21:38 UTC | |
|
Re^2: Simply Choking
by Grundle (Scribe) on Feb 08, 2005 at 19:52 UTC |