/usr/bin/perl use strict; use warnings; use XML::Twig; my $twig = XML::Twig->parse( map_xmlns => { 'http://www.w3.org/2001/XMLSchema' => 'xsd', }, \*DATA); printf "\$twig->root->gi: %s\n", $twig->root->gi; printf "\$twig->root->namespace: %s\n", $twig->root->namespace; __DATA__ #### $twig->root->gi: xsd:schema $twig->root->namespace: http://www.w3.org/2001/XMLSchema