Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

The mostly used xml parser

by pajout (Curate)
on Oct 05, 2005 at 08:07 UTC ( [id://497516]=perlquestion: print w/replies, xml ) Need Help??

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

I develop something as XML::Simple, but really simple. And I think which of xml parsers (with perl API) is the mostly used - I use XML::Parser::Expat... Please, post me your experience - I don't want to bind my module with exotic gnu (generally not used :) parser...

Replies are listed 'Best First'.
Re: The mostly used xml parser
by GrandFather (Saint) on Oct 05, 2005 at 08:16 UTC

    If XML::Simple does the job for you, use it. It is widely used and for simple applications won't go out of fashion in a hurry.

    If you need more power then take a look at XML::twig, especially if you are filtering XML, or perhaps XML::TreeBuilder if you want to move elements around.


    Perl is Huffman encoded by design.

      I've not found anything XML::Twig couldn't do. Including moving elements around. ;-) In fact, I use XML::Twig to manipulate HTML tables to "automatically" re-insert the header of the table every x rows (so you don't need to scroll too far to see the header info), and to change the class for each row (tr element) to alternate so that CSS can come by and change the background colour to make it again easier to follow with the eye.

      Perhaps XML::TreeBuilder would be easier for this. I'm not sure. Maybe XML::Twig is just my metaphorical hammer, and all XML problems seem to be nails to me. Or perhaps XML::Twig is the swiss-army-knife of XML processors, and I chose well. Up to you to decide. ;-)

        A month ago I'd not have mentioned XML::Twig - XML/HTML::TreeBuilder was my hammer. Having seen mention of XML::Twig] so frequently I've started using it too and it does do filtering (my first application for it) very nicely!

        What I'd like would be an HTML::Twig. Might not be as "easy" to write though :).


        Perl is Huffman encoded by design.
Re: The mostly used xml parser
by derby (Abbot) on Oct 05, 2005 at 10:42 UTC
      Yes! It seems that XML::LibXML::SAX is good for me, because I think about wide usage of whole XML::LibXML in my project, so I will not add dependencies...

      Agreed. By far the best XML module suite to date. Full-featured, devilishly fast and very frugal with the memory. Particularly the last part is kind of a killer criterion when you're twiddling XML using Perl.

      Makeshifts last the longest.

Re: The mostly used xml parser
by scollyer (Sexton) on Oct 05, 2005 at 09:50 UTC
    It's not "mostly used" but if you need an XML parser with good support for XML Schema, you could take a look at XML::Xerces which provides Perl bindings to the Apache Xerces XML implementation.

    One downside of this is that the developer is unlikely to be maintaining it for support of newer versions of Xerces (currently XML::Xerces supports Xerces 2.6.0, and Xerces 2.7.0 is available, with 3.0.0 being planned.

    The advantage is that Xerces is a very complete SAX2/DOM/XML Schema implementation with good support and wide usage.

    Steve Collyer

Log In?
Username:
Password:

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

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

    No recent polls found