I use XML::LibXML to do my XML parsing (fastest I've found, very complete, very reliable, clean interface), and I use XPaths (via findnodes) to extract data from the resulting tree.
Example:
my @forms = $xpc->findnodes('/plm:PLMXML/plm:Form');
for my $form (@forms) {
print( $form->getAttribute('subClass'), "\n" );
...
}
Example:
my ($form) = $xpc->findnodes(
'/plm:PLMXML/plm:Form[subClass="Part Revision Master"]'
)
or die("Can't find Part Revision Master form\n");
print($form->getAttribute('id'), "\n"); # id24
Update: Added examples.
Update: Fixed examples.
|