Class: Nokogiri::XML::Node
- Inherits:
-
Object
- Object
- Nokogiri::XML::Node
- Defined in:
- lib/xml/smart.rb
Instance Method Summary collapse
Instance Method Details
#xpath_experimental ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/xml/smart.rb', line 96 def xpath_experimental return NodeSet.new(document) unless document @nsc ||= 0 if @nsc != self.document.ns_counter @ctx = XPathContext.new(self) @ctx.register_namespaces(self.document.custom_namespace_prefixes.merge(self.document.user_custom_namespace_prefixes)) @nsc = self.document.ns_counter end path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml? @ctx.evaluate(path) end |
#xpath_fast(path) ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/xml/smart.rb', line 85 def xpath_fast(path) # return xpath(path,self.document.custom_namespace_prefixes.merge(self.document.user_custom_namespace_prefixes)) return NodeSet.new(document) unless document ns = self.document.custom_namespace_prefixes.merge(self.document.user_custom_namespace_prefixes) ctx = XPathContext.new(self) ctx.register_namespaces(self.document.custom_namespace_prefixes.merge(self.document.user_custom_namespace_prefixes)) path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml? ctx.evaluate(path) end |
#xpath_plain(path) ⇒ Object
82 83 84 |
# File 'lib/xml/smart.rb', line 82 def xpath_plain(path) XPathContext.new(self).evaluate(path) end |