And perhaps lastly, an XML::LibXML example.
use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->parse_string( do{ local $/; <DATA> } ); for my $button ( $doc->findnodes("//button") ) { print "A button\n"; for my $attr ( $button->attributes ) { printf "%30s --> %s\n", $attr->name, $attr->getValue; } } __DATA__ <?xml version="1.0" encoding="utf-8"?> <install type="module" version="1.0.0"> <name>TEST</name> <notebook_tabs> <tab index="1">Create <button internal_name="test1" parent="-1" text="button 1" x_coordinate="5" y_coordinate="5" x_size="-1" y_size="-1" evt_1="EVT_BUTTON" evt_1_function="testclick" /> <button internal_name="test2" parent="-1" text="button 2" x_coordinate="50" y_coordinate="50" x_size="-1" y_size="-1" evt_1="EVT_BUTTON" evt_1_function="testclick2" /> </tab> <tab index="2">Assign</tab> </notebook_tabs> </install>
In reply to Re: XML Parsing questions and recommendations?
by Your Mother
in thread XML Parsing questions and recommendations?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |