in reply to XML::LibXML and Namespace… I don't get it
The namespace is this bit:
xmlns="http://www.w3.org/1999/xhtml"
Not this bit:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
So you should be setting up your XPath context like this:
$xpc->registerNs( xml => "http://www.w3.org/1999/xhtml" );
That said, it's probably not a good idea to use the name "xml" for the XHTML namespace. Names beginning with those three letters are reserved for special purposes by the XML specification. So it's probably a better idea to use a different name:
$xpc->registerNs( h => "http://www.w3.org/1999/xhtml" );
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: XML::LibXML and Namespace… I don't get it
by ikegami (Patriarch) on Jun 06, 2014 at 16:49 UTC | |
by Skeeve (Parson) on Jun 06, 2014 at 17:05 UTC | |
Re^2: XML::LibXML and Namespace… I don't get it
by Skeeve (Parson) on Jun 06, 2014 at 17:04 UTC |
In Section
Seekers of Perl Wisdom