Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Kindly suggest a good starting point for XML Parsing.

by moritz (Cardinal)
on Dec 29, 2011 at 11:58 UTC ( #945489=note: print w/ replies, xml ) Need Help??


in reply to Kindly suggest a good starting point for XML Parsing.

There are basically two approaches to parsing XML: event-based and DOM-tree.

The first one reads an XML file, and calls user-defined subroutines whenever something interesting (opening or closing tags, attributes, text etc.). This has the advantage of not having to keep the whole XML file in the memory. A low-level event-based parser is XML::Parser, a more high-level is XML::Twig

The second one constructs a document tree, where each tag is a node that can contain further tags, attributes and text. This one requires you to keep the whole document in memory, but makes some types of processing much easier. The most well-known and mature Perl module that does this type of processing is XML::LibXML (which allows querying through XPath), a newer one is Mojo::DOM, which can be queried with CSS selectors.

Reading the documentation of these modules and maybe some examples here on perlmonks and on the Internet should give you a good idea what each are capable of.


Comment on Re: Kindly suggest a good starting point for XML Parsing.
Re^2: Kindly suggest a good starting point for XML Parsing.
by perl514 (Pilgrim) on Dec 29, 2011 at 12:27 UTC

    hi Moritz,

    Thank you sir.

     

    Perlpetually Indebted To PerlMonks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2014-08-30 21:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls