Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: XML::Parser - Obtaining Attributes

by runrig (Abbot)
on Jan 25, 2014 at 00:20 UTC ( [id://1072018]=note: print w/replies, xml ) Need Help??


in reply to XML::Parser - Obtaining Attributes

I, too, would use something other than XML::Parser, (e.g. XML::Rules), but to answer your question, you need to tell the parser what your handlers are:
my $parser = new XML::Parser( Handlers => { Start => \&StartTag, }, );

Replies are listed 'Best First'.
Re^2: XML::Parser - Obtaining Attributes
by DanielSpaniel (Scribe) on Jan 25, 2014 at 00:41 UTC
    Thanks for the comment.

    Actually it defaults to the sub StartTag anyway, so no worries there, and the script has no problems processing the rest of the file; it really is just the attributes bit that I have an issue with.

    If I can't meet with any success then I guess maybe I'll have to use another module, but I'd really rather find out why this particular bit won't work.

      Actually it defaults to the sub StartTag anyway,

      I see that now (when you call with Style => 'Stream'), but if you read more closely, you'll see that with the Stream style, it does not call the sub with the arguments in @_. The attributes, e.g., are in %_.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-19 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found