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.


In reply to Re^5: XML::Twig replace method behaving counter-intuitively by Jenda
in thread XML::Twig replace method behaving counter-intuitively by Human

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.