XML, the Perl Way

Processing XML with Perl Michel Rodriguez

XML::Parser Methods

Things to know about XML::Parser

XML::Parser Handlers

Handler Args Remark
Start$expat, $element[, $attr, $val [, ...])- generated when a start tag is parsed
- $attr/$val pairs are generated for each attribute
End$expat, $element- generated when an end tag is parsed
- an empty tag <foo/> generates calls to both Start and End handlers
Char$expat, $string- called also for inter-tag spaces
- a single sequence of characters can trigger multiple calls to this handler
- the string is ALWAYS UTF-8 encoded
Default$expat, $string- called for anything that has no declared handler
- the string is UTF-8 encoded
Init$expat- called before the parsing starts
End$expat- called after the parsing finished
many more handlers (for PI, CDATA, entity, DTD parts XML declaration...)...


XML::Parser Methods

Things to know about XML::Parser