Class: Nokogiri::XML::XPath

Inherits:
Object
  • Object
show all
Defined in:
lib/nokogiri/xml/xpath.rb,
lib/nokogiri/ffi/xml/xpath.rb,
lib/nokogiri/xml/xpath/syntax_error.rb,
ext/nokogiri/xml_xpath.c

Defined Under Namespace

Classes: SyntaxError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cstructObject

:nodoc:



5
6
7
# File 'lib/nokogiri/ffi/xml/xpath.rb', line 5

def cstruct
  @cstruct
end

#documentObject

The Nokogiri::XML::Document tied to this XPath instance



7
8
9
# File 'lib/nokogiri/xml/xpath.rb', line 7

def document
  @document
end

Instance Method Details

#node_setObject

Fetch the node set associated with this xpath context.



7
8
9
10
11
12
13
14
15
# File 'lib/nokogiri/ffi/xml/xpath.rb', line 7

def node_set # :nodoc:
  ptr = cstruct[:nodesetval] if cstruct[:nodesetval]
  ptr = LibXML.xmlXPathNodeSetCreate(nil) if ptr.null?

  set = XML::NodeSet.new(@document)
  set.cstruct = LibXML::XmlNodeSet.new(ptr)
  set.document = @document
  set
end