Class | Openwsman::XmlNode |
In: |
../openwsman.i
openwsman/xmlnode.rb |
Parent: | Object |
text | -> | to_s |
string | -> | to_xml |
equal | -> | == |
iterate over children
See also XmlNode#next
XmlNode#each iterates over children, XmlNode#next over siblings
can be limited to children with specific name (and specific namespace)
for array-like constructs, e.g
<Parent> <Child>.. <Child>.. <Child>.. <OtherChild>.. <OtherChild>.. <OtherChild>.. doc.Parent.each do |child| ... iterates over all 6 children ... end
use XmlNode#next as in
node = doc.OtherChild while node do ... do something with node ... node = node.next end
get end point reference
iterate over siblings
finds next sibling with same namespace and name
See also XmlNode#each
XmlNode#each iterates over children, XmlNode#next over siblings
Example:
<Foo> <Bar>... <Bar>... <Bar>... <Bar>... <Other>... <Other>... </Foo>
node = root.Foo # points to <Foo> node
bar = node.Bar while bar do bar = bar.next end
will give you four iterations (all <Bar> nodes)
child = node.Bar while child do child = child.next(1) end
will give you six iterations (all children of <Foo>) The latter example is equal to
node.each do |child| ... end