Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: XML::Filter::Dispatcher string rules problem

by barries (Initiate)
on Jan 10, 2003 at 14:19 UTC ( [id://225795]=note: print w/replies, xml ) Need Help??


in reply to XML::Filter::Dispatcher string rules problem

Am I doing something wrong?

Yup. Yer using poorly documented OSS software ;)

The SYNOPSIS is badly outdated; I've updated it. The SYNOPSIS in the released version dates from before I made X::F::D more compliant with XPath. The updated SYNOPSIS looks like:

use XML::Filter::Dispatcher qw( :all ); my $f = XML::Filter::Dispatcher->new( Rules => [ 'foo' => \&handle_foo_start_tag, '@bar' => \&handle_bar_attr, ## Send any <foo> elts and their contents to $handler 'snarf//self::node()' => $handler, ## Print the text of all <description> elements 'description' => [ 'string()' => sub { push @out, xvalue } ], ], Vars => { "id" => [ string => "12a" ], }, );

The change that affects you is that string() now only looks at the first node in the nodeset as per XPath, so you need to get X::F::D to visit all the desired element nodes and then call string() nodes.

There's now a t/synopsis.t that has the audacity to test the code from the SYNOPSIS. The next release will be heading CPANward as soon as I submit this.

Thanks for the bug report.

- Barrie

P.S. I only found this question thanks to Matt Sergeant mentioning it. In general, while perlmonks is a nice resource, I recommend posting XML related questions to the perl-xml@listserv.ActiveState.com mailing list.

Replies are listed 'Best First'.
Re^2: XML::Filter::Dispatcher string rules problem (t/synopsis.t!)
by tye (Sage) on Jan 10, 2003 at 17:14 UTC
    There's now a t/synopsis.t that has the audacity to test the code from the SYNOPSIS. The next release will be heading CPANward as soon as I submit this.

    What a cool idea. Everyone should do this. Does it extract the code or did you just cut'n'paste? ++barries

                    - tye
Re: Re: XML::Filter::Dispatcher string rules problem
by toma (Vicar) on Jan 10, 2003 at 21:16 UTC
    Thanks! This fixed my problem. Thanks also for the information on other sources of XML information.

    My evaluation of XML::Filter::Dispatcher was suggested by Matts when he commented on my blog at use perl. Like perl itself, much of the value of XML is the great group of people that are working on it and helping others.

    Thanks again!

    It should work perfectly the first time! - toma

Log In?
Username:
Password:

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

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

    No recent polls found