in reply to Re: Trying to use XML::Twig
in thread Trying to use XML::Twig

Thanks, I'm back from eating my gruel...
http://www.standards.ieee.org/resources/spasystem/twig/twig_dev.html
That is where I saw the
within_element($gi) Call Expat within_element method. Returns the number of times the given name appears in the context list. If namespace processing is being used and you want to check against a name that may be in a namespace, then use the generate_ns_name method to create the $gi argument. Usefull when using the TwigRoots option.

Replies are listed 'Best First'.
Re: Re: Re: Trying to use XML::Twig
by mirod (Canon) on Sep 21, 2001 at 22:03 UTC

    Consider this a bad case of cut'n paste. The doc for within_element is from the original XML::Parser::Expat method. In fact this method should only be used during the parsing, if you are using the twig_roots option, to get information about the original document, not the view on it defined by twig_roots... if that makes any sense.

    Basically you should use $elt->ancestors( $gi) in scalar context to getthe number of ancestors of type $gi for the element $elt. Which does not look like what you wanted anyway ;--(

    Thanks for letting me know about this silly documentation bit though, I will fix it in the next release.