CC: | garfieldnate [...] gmail.com |
Subject: | make default namespace optional |
In HTML5, the http://www.w3.org/1999/xhtml namespace is completely optional. In the browser, document.evaluate() does not require XPaths to explicitly use this namespace, so using default namespaces is fine.
By setting the default namespace on the returned document, this module requires any Perl-side XPath querying to explicitly define and use the xhtml namespace, which requires the creation of an XpathContext object.
Since I'm working with XPath both in browsers and in Perl, I like to be able to use the same expressions in both, which isn't possible when the default namespace is added. Removing namespaces is complicated because the document must be traversed to remove the namespace from all elements. Therefore, I'd like it if the user could specify "namespace => 0" in the constructors (parse_string parse_file parse_fh) to prevent the parser from setting the default namespace.