spx2 has asked for the wisdom of the Perl Monks concerning the following question:

I need a module for generating XML , so that I can at a later time come back and update it with some new data , for that purpose XML::Writer (or XML::Writer::Nest ) is not doing what I need to do so I'm searching for another one that has a fairly simple and quick-to-learn api and a way to serialize/parse.

I'll make it more clear on what I mean by 'update' , I need to be able to say "get the nodes on that depth level , with that particular tagname and those attributes and do this stuff to them" , I guess that would be XQuery , is there any such module out there where I can use with XQuery ?

If possible I'd also like to delete/edit data elements .

I'm pretty sure there are a lot of modules for this on CPAN , I want to know if there is one which fits my needs.

Replies are listed 'Best First'.
Re: XML module which talks XQuery
by GrandFather (Saint) on May 28, 2009 at 02:26 UTC
Re: XML module which talks XQuery
by Jenda (Abbot) on May 28, 2009 at 17:33 UTC
    use XML::Rules; my $updater = XML::Rules->new( style => 'filter', rules => { 'particular_tagname' => sub { my ($tag, $attr, $context) = @_; if (@$context == $that_depth_level and $attr->{this_atribute} eq 'some value' ) { do_stuff_to($attr); } return $tag => $attr; }, } ); $updater->filterfile( $infile, $outfile);

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

Re: XML module which talks XQuery
by dHarry (Abbot) on May 28, 2009 at 06:27 UTC

    AFAIK there is no Perl module that supports XQuery. See W3C XML Query (XQuery) for XQuery implementations. Also at sourceforge you can find a few. A more Perlish way of doing things is XML::Twig as mentioned above. This is probably your best option to achieve the things you want.