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

Re: best xml parser to use

by Tanktalus (Canon)
on Jul 06, 2006 at 18:07 UTC ( #559637=note: print w/replies, xml ) Need Help??

in reply to best xml parser to use

My general decision tree goes sorta like this (non-XML parts removed):

/----------\ +-----------+ < Parse XML? > --NO>-- | (removed) | \----------/ +-----------+ | YES V | +---------------+ | Use XML::Twig | +---------------+
Hopefully this decision tree helps you decide what is best.


Replies are listed 'Best First'.
Re^2: best xml parser to use
by ftumsh (Scribe) on Jul 06, 2006 at 19:03 UTC
    heh :)
    I normally always use xml::twig, but I don't actually know the format of xml so I can't in this case. I've been googling and I'm going to try xml::sax.

    I appear to have only got xml::libxml::sax, is this good enough? the pod mention it might not be any good for production use. What others could I use?

      What do you mean by "I don't actually know the format of xml"? How will switching parsers (though, technically, XML::Twig is a front-end, not a parser itself) fix that?
        XML Twig saves on memory by only reading in bits of the xml. To know what bits you are interested in you have to tell it. As I don't know what tags will be used for a given document I can't do that so it would load the entire xml into memory which negates the point of Twig.
Re^2: best xml parser to use
by Jenda (Abbot) on Aug 14, 2006 at 17:19 UTC
    if ($xml->is_simple() and $xml->is_table_like()) { use XML::RAX; } elsif (size($xml) < too_big()) { use XML::Simple; } else { use XML::Twig; ... my $Data = $DataObj->simplify(forcearray => [...], keyattr =>{ ... } +, group_tags => {...}); }

    Update 2007-2-6: Tastes change. While I would probably still use XML::RAX for some tasks with table-like XML and XML::Simple for very simple XMLs, I'd most probably use my XML::Rules now. May look a bit twisted at first, but it's convenient and powerfull. IMHO of course ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://559637]
and not a whimper to be heard...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2017-10-23 05:50 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (277 votes). Check out past polls.