Module: Libxml4r::XML::Node
- Defined in:
- lib/libxml4r.rb
Instance Method Summary (collapse)
-
- (Object) inner_html
:call-seq:.
-
- (Object) last=(node)
:call-seq:.
-
- (Object) node
:call-seq:.
-
- (Object) node_at(xpath)
:nodoc:.
-
- (Object) nodes
:call-seq:.
-
- (Object) nodes_at(xpath)
:nodoc:.
-
- (Object) to_xml
:call-seq:.
Instance Method Details
- (Object) inner_html
98 99 100 |
# File 'lib/libxml4r.rb', line 98 def inner_html self.inner_xml end |
- (Object) last=(node)
107 108 109 |
# File 'lib/libxml4r.rb', line 107 def last=(node) return self.sibling = node end |
- (Object) node
:call-seq:
self.node["/xpath"] -> XML::Node
Returns the first Node object matching "/xpath", or nil if no object could not be found. The path searched is relative to the node from which node[] was called.
Note its usually recommended to remove all namespaces with strip! before xpath traversal.
119 120 121 |
# File 'lib/libxml4r.rb', line 119 def node() return SearchNodes.new(:node => self, :return_many => false) end |
- (Object) node_at(xpath)
:nodoc:
123 124 125 |
# File 'lib/libxml4r.rb', line 123 def node_at(xpath) #:nodoc: self.find_first(xpath) end |
- (Object) nodes
:call-seq:
self.nodes["/xpath"] -> [XML::Node, XML::Node, XML::Node, ...]
Returns an array containing all nodes matching "/xpath", or nil if no object could not be found. The path searched is relative to the node from which node[] was called.
Note its usually recommended to remove all namespaces with strip! before xpath traversal.
134 135 136 |
# File 'lib/libxml4r.rb', line 134 def nodes() return SearchNodes.new(:node => self, :return_many => true) end |
- (Object) nodes_at(xpath)
:nodoc:
138 139 140 141 142 143 144 145 146 |
# File 'lib/libxml4r.rb', line 138 def nodes_at(xpath) #:nodoc: results = self.find(xpath).to_a if block_given? results.each do |result| yield result end end return results end |
- (Object) to_xml
192 193 194 |
# File 'lib/libxml4r.rb', line 192 def to_xml return self.to_s end |