| use XML::Parser; $xml = "<z xmlns='http://one.org' xmlns:two='http://two.org'><y1 /><two:y2 /></z>"; $p = new XML::Parser(Namespaces => 1, Handlers => { Start => \&STag }); $p->parse($xml); sub STag { my ($expat, $type) = @_; my $ns = $expat->namespace($type); print "Element type $type is from namespace $ns\n"; } Element type z is from namespace http://one.org Element type y1 is from namespace http://one.org Element type y2 is from namespace http://two.org |