Subject: | XML::Mini may produces invalid XML documents. |
XML-Mini-1.2.8
This is perl, v5.8.0 built for i586-linux-thread-multi
Linux asmodan 2.4.20-4GB #1 Wed Apr 16 14:50:03 UTC 2003 i686 unknown nknown GNU/Linux
While trying to update an existing document, by using
[code]
$mini->fromFile("myFile.xml");
$root=$mini->getRoot;
# commands come here: $root->createChild('x')->text('y');
$mini->toFile("$document/.meta-document.xml",TRUE);
[/code]
XML::Mini::Document will produce invalid documents by reordering the '<?xml ... ?> header's attributes. Everything works fine as long as i just have '<?xml version="1.0"?>', but if i try to apply this code on a document that has '<?xml version="1.0" encoding="ISO-8859-1"?>', the generated document will have '<?xml encoding="ISO-8859-1" version="1.0"?>', which makes /xmllint/ tool complaint (as well as other tools like XML::XPath, for instance)
MyFile.xml error: Malformed declaration expecting version
<?xml encoding="ISO-8859-1" version="1.0"?>
^
MyFile.xml:1: error: Blank needed here
<?xml encoding="ISO-8859-1" version="1.0"?>
^
MyFile.xml:1: error: parsing XML declaration: '?>' expected
version="1.0"?>
^
haven't tried to patch yet, but i guess replacing a hash by a list somewhere would definitely help ...