ruby - XML Namespace issue with Nokogiri -
i have following xml:
<body> <hello xmlns='http://...'> <world>yes</world> </hello> </body> when load nokogiri xml document, , call document.at_css "world", receive nil back. when remove namespace hello, works perfectly. know can call document.remove_namespaces!, why it not work namespace?
because nokogiri requires register xml namespaces querying within (read more xml namespaces). should still able query element if specify namespace when calling at_css. see exact usage, check out css method documentation. should end looking this:
document.at_css "world", 'namespace_name' => 'namespace uri'
Comments
Post a Comment