in reply to XML::Twig and oodraw

If you are just trying to print the value of the 'draw:name' attribute, the use the att method. I had to fix the 1st line of your XML to make it valid.
use strict; use warnings; use XML::Twig; my $xmlStr = <<XML; <draw:frame draw:id="id2" draw:layer="layout" draw:name="objectName" d +raw:style-name="gr1" draw:text-style-name="P3"> <draw:text-box> <text:p text:style-name="P1"> <text:span text:style-name="T2">objectData</text:span> </text:p> </draw:text-box> </draw:frame> XML my $twig= new XML::Twig( twig_handlers => { 'draw:frame' => \&getDrawInfo } ); $twig->parse($xmlStr); exit; sub getDrawInfo { my ($t, $data) = @_; print $data->att('draw:name'), "\n"; } __END__ objectName

Replies are listed 'Best First'.
Re^2: XML::Twig and oodraw
by carcassonne (Pilgrim) on Oct 09, 2009 at 15:33 UTC
    Thanks. The $data->att('draw:name') you are using requires less typing and makes it more to the point.