The namespace
method will provide the namespace for the given HTML element if it is present. This method is provided by the Mojo::DOM
module, which is an HTML/XML DOM parser with CSS selectors.
$dom->at('html element')->namespace
This method will return the namespace
for the given element if it is present. Otherwise, it will return undef
.
use 5.010;use Mojo::DOM;# Parse the htmlmy $dom = Mojo::DOM->new('<svg xmlns:svg="http://www.w3.org/2000/svg"><svg:circle>3.14</svg:circle></svg>');# Get namespacesay $dom->at('svg\:circle')->namespace;
Mojo::DOM
module.$dom
scalar.svg:circle
using the namespace method and print it.