Dear fellow Monks,
I am in receipt of an xml message. What is the best way to retrieve the xmlns (namespace) attribute from the root element of that message using XML::LibXML??
If it helps, I am expecting GovTalkMessages of the format:
<!-- A valid Body payload with a namespace declaration on the first el
For bonus points, please tell me if there is any way of avoiding using XPathContext and adding the namespace identifier to all xpath queries on the resulting DOM.
e.g. do I really have to do:
my $dom = XML::LibXML->load_xml( string => $xml);
my $xc = XML::LibXML::XPathContext->new($dom);
$xc->registerNs( 'gt', 'http://www.govtalk.co.uk/CM/envelope');
$envelopeVersion = $xc->findvalue( '//gt:EnvelopeVersion');
A Monk aims to give answers to those who have none, and to learn from those who know more.