my $xpc = XML::LibXML::XPathContext->new($dom); $xpc->registerNs('gml', 'http://graphml.graphdrawing.org/xmlns'); if (my $graphNode = @{$xpc->findnodes('/gml:graphml/gml:graph')}[0] ) { if ($graphNode->hasAttributes()) { my $directed = $graphNode->getAttribute('edgedefault') || ''; print "edgedefault = '$directed'\n"; } } else { print "did not find graph node edgedefault value\n"; }