XML::Parser And Tutorials


Table of Contents

mod:XML::Parser 
NAME 
DESCRIPTION 
XML::Simple 
Using Perl with XML (part 1) 
Perl XML::Parser module - Mini HowTo 
Introducing XML::Parser 
Events 
How the events are handled? 
Conclusion 
Parsing XML documents with Perl 
Parsing XML documents with Perl 
Listing A 
Listing B 
XML::Parser Tutorial 
Introduction 
The data 
The code 
Summary 
subclassing vs. global variables 
Comments 
Comments 
Comments 

mod:XML::Parser 

NAME 

XML::Parser - A multi-thread perl module for parsing XML documents

DESCRIPTION 

This module provides ways to parse XML documents. It is built on top of XML::Parser::Expat, which is a lower level interface to James Clark's expat library.

Each call to one of the parsing methods creates a new instance of XML::Parser::Expat which is then used to parse the docu- ment. Expat options may be provided when the XML::Parser object is created. These options are then passed on to the Expat object on each parse call. They can also be given as extra arguments to the parse methods, in which case they override options given at XML::Parser cre- ation time.

The behavior of the parser is controlled either by ""Style"" and/or ""Handlers"" options, or by "setHandlers" method. These all provide mechanisms for XML::Parser to set the handlers needed by XML::Parser::Expat. If neither "Style" nor "Handlers" are specified, then parsing just checks the document for being well-formed.

When underlying handlers get called, they receive as their first parameter the Expat object, not the Parser object.

XML::Simple 

Since you have to install XML::Parser anyway, you might as well use XML::Simple (a nice wrapper for XML::Parser) that will parse the whole thing and return back a hash ref of all the data. That would cut this document down to 1 page of formatting it html. This should have at least mentioned XML::Simple or it should have done the parsing manually (using regex's).