moleary has asked for the
wisdom of the Perl Monks concerning the following question:
I need to write a script that parses several XML files, collecting information from them to write to an output file. I have used XML::Parser to do this kind of thing before, but only on files that have a !DOCTYPE line at the top that indicates a dtd file for the XML file being parsed. The XML files I am working with now do not have !DOCTYPE lines. It apparently will not necessarily be possible for users of my script to edit the XML files and insert a !DOCTYPE line in them, so I have to use the XML files as they are. Now, when I run the first draft of my script on one of these files, it returns an error when it hits a line like:
<restriction text="Cannot be used worldwide for Art décor" />
The entity declarations in a dtd file would indicate how é should be interpreted, and I am wondering what I can do to parse tags that contain entities like this when a dtd file is not available. I have tried various things with the handlers and other arguments of XML::Parser, but I haven't found the right configuration to make it work. Is there something that I have simply overlooked, or do I need to use a different approach?