Posted on 2007-06-27 17:29:07-07 by dbmathis
XML::Twig crashing when encountering unqouted ampersand.
I have a few mal-formed XML documents that XML::Twig is not liking too much. The XML documents contain a & outside of a CDATA tag.

Can XML::Twig ignore any unquoted character that appears outside of a CDATA tag and just throw it out when parsing or is there anything available that will pre scan the document and remove characters before XML:Twig parses the XML?

Thanks.
Direct Responses: 5560 | Write a response
Posted on 2007-06-27 20:41:11-07 by mirod in response to 5558
Re: XML::Twig crashing when encountering unqouted ampersand.

No, it can't.

XML::Twig is based on an XML parser, which like all XML parsers, refuses to work with mal-formed XML. It only works with XML. That is part of the XML spec. I am afraid you will have to pre-process yur data to turn it into well-formed XML before using any XML tool on it.

Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.