I am sorry I cannot answer right now (I am at XML Europe and web access is pretty difficult here, all of 4 machines from xml.com).

Maybe the problem is that when you purge the twig the uncles disappear. Or that anything outside the twig_roots is not part of the twig (it is not loaded at all).

Sorry for the lack of support, just send me an email next week and I will have a look at it.

Update: OK, we're lucky, I managed to grab a machine for a couple of minutes, so here it is:

Your code does not work because when you set a handler on /log/msg/error it is called just after the end tag for error has been parsed. At this point the request element has not yet been parsed.

From the handler on /log/msg/error you can access the element previous siblings, but not the next ones, they have not been parsed yet.

The easiest solution is probably to put a handler on /log/msg and from there test whether there is an error child. At this point the entire msg element will have been parsed and you will be able to access all of its children.

Good question though, I'll make sure it makes it into the FAQ.


In reply to Re: XML::Twig - can't find my uncle! by mirod
in thread XML::Twig - can't find my uncle! by DrSax

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.