in reply to Re^4: XML::Twig replace method behaving counter-intuitively
in thread XML::Twig replace method behaving counter-intuitively

XML::Rules is built on top of XML::Parser, I do not try to parse the XML, load the DTDs and all that myself. So yes DTD and ENTITY references should work just fine.

The toXML() preserves ordering whereever the data stucture does. So if the datastructure contains something like

... foo => { name => "Jenda", address => 'Jenda@Krynicky.cz', bar => {_content => 'hello'}, ban => {_content => 'hi'}, },
then of course the hash defining the contents of the foo tag doesn't keep the order so the attributes and the subtags are printed in alphabetical order:
<foo address="Jenda@Krynicky.cz" name="Jenda"><ban>hi</ban><bar>hello< +/bar></foo>
If on the other hand you include the subtags in the _content like this:
... foo => { name => "Jenda", address => 'Jenda@Krynicky.cz', _content => [ "\n ", [bar => {_content => 'hello'}], "\n ", [ban => {_content => 'hi'}], "\n" ], },
you end up with this:
<foo address="Jenda@Krynicky.cz" name="Jenda"> <bar>hello</bar> <ban>hi</ban> </foo>

Same way if you repeat the child tag for example like this

foo => { name => 'Jenda', sibling => ['Pavel', 'Martin', 'Hana'], }
and end up with
<foo name="Jenda"><sibling>Pavel</sibling><sibling>Martin</sibling><si +bling>Hana</sibling></foo>

I'm sorry, I haven't used XML::Twig for quite long and when I was using it, I just extracted data, I've never tried to use it as a filter.