Processing XML with Perl | Michel Rodriguez |
Introduction to XML::Parser | XML::Parser Handlers |
XML::Parser Methods
XML::Parser offers 2 main methods::
- parse( $string): parse the string, alternatively $string can be an open file handle
- parsefile( $filenale): parse the file
XML::Parser::Expat Methods
those methods can be called from any handler:
Method | Return value |
depth | the current depth in the tree during parsing |
in_element( $gi) | true if the current element is $gi |
within_element( $gi) | the number of times $gi appears in the current context list |
recognized_string | the UTF-8 encoded string recognized by the parser |
original_string | the original string recognized by the parser |
Introduction to XML::Parser | XML::Parser Handlers |