John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
However, I need to access some attributes from the root element. If I don't use twig_roots then it has to load the whole file and it's not as trivial to simply not print nodes to be removed. It kind of defeats the main feature of Twig.
Is there a good way to read the attributes from the top-level element, and then configure the twigs (and print outside roots) and callbacks based on what I found? How to get what was already read to print seemlessly with what it will start handling differently?
Another idea is to start processing, then quit after the first start tag. Is there a flag or something that can be set from the callback to "cancel" and return from parse() without reading any more from the file?
—John
2006-05-05 Retitled by GrandFather, as per Monastery guidelines
Original title: 'accessing root tags when XML::Twig and twig_roots'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: accessing root tags when using XML::Twig and twig_roots
by mirod (Canon) on May 04, 2006 at 16:53 UTC | |
by John M. Dlugosz (Monsignor) on May 04, 2006 at 19:25 UTC | |
by Argel (Prior) on May 04, 2006 at 20:27 UTC | |
by John M. Dlugosz (Monsignor) on May 05, 2006 at 21:14 UTC | |
by mirod (Canon) on May 04, 2006 at 19:37 UTC |