in reply to [SOLVED] XML::Twig - Parsing XML file with incorrect encoding in declaration

XML::Twig only looks at the xml-declaration and complains about a wrong encoding if it (the declararion) is there. If it isn't, it parses the xml just fine and doesn't care about the encoding. So, if you just read the first line from the handle you read from before passing it to the parse method you are fine. In your case:
# ... yadda my $encodingLine = <DATA>; print "Ommiting <$encodingLine>\n"; $t->safe_parse(\*DATA); # bumm ...


holli

You can lead your users to water, but alas, you cannot drown them.
  • Comment on Re: XML::Twig - Parsing XML file with incorrect encoding in declaration
  • Download Code