Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: XML::Twig TwigHandler for attributes?

by PodMaster (Abbot)
on Sep 11, 2002 at 00:51 UTC ( #196841=note: print w/replies, xml ) Need Help??

in reply to XML::Twig TwigHandler for attributes?

I'm just going to quote the pod, mmkay (don't got perl handy). It looks like you're looking for "attribute_condition" :
This argument replaces the corresponding XML::Parser argument. It consists of a hash { expression => \&handler} where expression is a generic_attribute_condition, string_condition, an attribute_condition,full_path, a partial_path, a gi, _default_ or <_all_>.

The idea is to support a usefull but efficient (thus limited) subset of XPATH. A fuller expression set will be supported in the future, as users ask for more and as I manage to implement it efficiently. This will never encompass all of XPATH due to the streaming nature of parsing (no lookahead after the element end tag).

A generic_attribute_condition is a condition on an attribute, in the form *[@att=``val''] or *[@att], simple quotes can be used instead of double quotes and the leading '*' is actually optional. No matter what the gi of the element is, the handler will be triggered either if the attribute has the specified value or if it just exists.

An attribute_condition is a simple condition of an attribute of the current element in the form gi[@att=``val''] (simple quotes can be used instead of double quotes, you can escape quotes either). If several attribute_condition are true the same element all the handlers can be called in turn (in the order in which they were first defined). If the =``val'' part is ommited ( the condition is then gi[@att]) then the handler is triggered if the attribute actually exists for the element, no matter what it's value is.

** The Third rule of perl club is a statement of fact: pod is sexy.

  • Comment on Re: XML::Twig TwigHandler for attributes?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://196841]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2020-05-31 01:15 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (173 votes). Check out past polls.