NAME
XML::Node::register - register a call back function or a variable for a particular node
XML::Node::parse - parse an XML file
SYNOPSIS
use XML::Node;
register( $nodetype, $callback_type => \&callback_function );
register( $nodetype, $callback_type => \$variable );
parse( $xml_filename );
DESCRIPTION
If you are only interested in processing certain nodes in an XML file, this module can help you.
The XML::Node module allows you to register callback functions or variables for any XML node. If you register a call back function, it will be called when the node of the type you specified are encountered. If you register a variable, the content of a XML node will be appended to that variable automatically.
Subroutine ®ister accepts both absolute and relative node registrations.
Example of absolute path registration:
1. register(">TestCase>Name", "start" => \& handle_TestCase_Name_start);
Example of single node registration:
2. register( "Name", "start" => \& handle_Name_start);
3. register( "Name", "end" => \& handle_Name_end);
4. register( "Name", "char" => \& handle_Name_char);
Abosolute path trigger condition is recommended because a "Name" tage could appear in different places and stands for differe name.
Example:
1 <Testcase>
2 <Name>Something</Name>
3 <Oracle>
4 <Name>Something</Name>
5 </Oracle>
6 </Testcase>
Statement 1 causes &handle_TestCase_Name_start to be called when parsing Line 2. Statements 2,3,4 cause the three handler subroutines to be called when parsing both Line 2 and Line 4.
This module uses XML::Parser.
EXAMPLE
File "test.pl", which comes with this perl module, has an example.
NOTE
When you register a variable, XML::Node appends strings found to that variable. So please be sure to clear that variable when needed.
AUTHORS
Chang Liu <liu@ics.uci.edu>
LAST MODIFIED
10/20/1999