Subject: | Xml-tiny pukes on BOM |
If you make the mistake of editing a UTF8 XML file with Notepad on
windows, it will save it with a BOM. Unfortunately, XML::Tiny dies with
this message:
Junk after end of document
XML::Parser catches it fine.
BOM: http://en.wikipedia.org/wiki/Byte_order_mark
A test:
DB<15> $p1 = new XML::Parser(Style => 'Debug');
DB<19> $p1->parse("<a><b c='1'></b></a>")
\\ ()
a \\ (c 1)
a //
//
DB<20> $p1->parse("\xef\xbb\xbf<a><b c='1'></b></a>")
\\ ()
a \\ (c 1)
a //
//
DB<22> x XML::Tiny::parsefile("_TINY_XML_STRING_\xef\xbb\xbf<a><b
c='1'></b></a>")
Junk after end of document
DB<23> x XML::Tiny::parsefile("_TINY_XML_STRING_<a><b c='1'></b></a>")
0 ARRAY(0x1b76394)
0 HASH(0x1b762bc)
'attrib' => HASH(0x1b0fea4)
empty hash
'content' => ARRAY(0x1b3f9b8)
0 HASH(0x1c89dc0)
'attrib' => HASH(0x1b3f9a0)
'c' => 1
'content' => ARRAY(0x1b40880)
empty array
'name' => 'b'
'type' => 'e'
'name' => 'a'
'type' => 'e'