Fix XPath queries using default XML namespace

This fixes https://gitlab.com/yorickpeterse/oga/issues/195
This commit is contained in:
KitaitiMakoto authored and Yorick Peterse committed 2019-12-02 17:40:11 +00:00
1 parent d492a775bf
commit 95da93949b
2 files changed
+29 -2

No files matched your search

+7 -2
View File
@@ -1391,14 +1391,19 @@ module Oga
if ns and ns != STAR
if @namespaces
ns_uri = @namespaces[ns]
ns_match =
ns_match =
if ns_uri
input.namespace.and(input.namespace.uri.eq(string(ns_uri)))
else
self.false
end
else
ns_match = input.namespace_name.eq(string(ns))
ns_match =
if ns == XML::Element::XMLNS_PREFIX
input
else
input.namespace_name.eq(string(ns))
end
end
condition = condition ? condition.and(ns_match) : ns_match