Class: Nokogiri::XML::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/smart.rb

Instance Method Summary collapse

Instance Method Details

#xpath_fast(path) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/xml/smart.rb', line 75

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
  @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_plain(path) ⇒ Object



72
73
74
# File 'lib/xml/smart.rb', line 72

def xpath_plain(path)
  XPathContext.new(self).evaluate(path)
end