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.
In reply to Re: Kindly suggest a good starting point for XML Parsing.
by moritz
in thread Kindly suggest a good starting point for XML Parsing.
by perl514
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |