A Child object is something contained by a parent,
and this class contains methods to support that. Most user code will not
use this class directly.
next_sibling_node -> next_sibling
previous_sibling_node -> previous_sibling
Node
Constructor. Any inheritors of this class should call super to make sure
this method is called.
parent: | if supplied, the parent of this child will be set to the supplied value,
and self will be added to the parent
|
Removes this child from the parent.
Sets the parent of this child to the supplied argument.
other: | Must be a Parent object. If this object is the
same object as the existing parent of this child, no action is taken.
Otherwise, this child is removed from the current parent (if one exists),
and is added to the new parent.
|
Returns: | The parent added
|
Sets the next sibling of this child. This can be used to insert a child
after some other child.
a = Element.new("a")
b = a.add_element("b")
c = Element.new("c")
b.next_sibling = c
# => <a><b/><c/></a>
Sets the previous sibling of this child. This can be used to insert a child
before some other child.
a = Element.new("a")
b = a.add_element("b")
c = Element.new("c")
b.previous_sibling = c
# => <a><b/><c/></a>
Returns: | the document this child belongs to, or nil if this child
|
belongs to no document
This doesn’t yet handle encodings