Class REXML::Child
In: src/rexml/child.rb
Parent: Object

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.

Methods
bytes    document    new    next_sibling=    parent=    previous_sibling=    remove    replace_with   
External Aliases
next_sibling_node -> next_sibling
previous_sibling_node -> previous_sibling
Attributes
parent  [R] 
Included modules
Node
Public Class methods
new( parent = nil )

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
Public Instance methods
replace_with( child )

Replaces this object with another object. Basically, calls Parent.replace_child

Returns:self
remove()

Removes this child from the parent.

Returns:self
parent=( other )

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
next_sibling=( other )

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>
previous_sibling=(other)

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>
document()
Returns:the document this child belongs to, or nil if this child

belongs to no document

bytes()

This doesn’t yet handle encodings