... >
+ # child = top_element.first # => ... >
+ # d.root_node == d # => true
+ # top_element.root_node == d # => true
+ # child.root_node == d # => true
+ #
+ # When the element is not part of a document, but does have ancestor elements,
+ # returns the most distant ancestor element:
+ #
+ # e0 = REXML::Element.new('foo')
+ # e1 = REXML::Element.new('bar')
+ # e1.parent = e0
+ # e2 = REXML::Element.new('baz')
+ # e2.parent = e1
+ # e2.root_node == e0 # => true
+ #
+ # When the element has no ancestor elements,
+ # returns +self+:
+ #
+ # e = REXML::Element.new('foo')
+ # e.root_node == e # => true
+ #
+ # Related: #root, #document.
+ #
+ # pkg:gem/rexml#lib/rexml/element.rb:422
+ def root_node; end
+
+ # :call-seq:
+ # text(xpath = nil) -> text_string or nil
+ #
+ # Returns the text string from the first text node child
+ # in a specified element, if it exists, +nil+ otherwise.
+ #
+ # With no argument, returns the text from the first text node in +self+:
+ #
+ # d = REXML::Document.new "some text this is bold! more text
"
+ # d.root.text.class # => String
+ # d.root.text # => "some text "
+ #
+ # With argument +xpath+, returns text from the first text node
+ # in the element that matches +xpath+:
+ #
+ # d.root.text(1) # => "this is bold!"
+ #
+ # Note that an element may have multiple text nodes,
+ # possibly separated by other non-text children, as above.
+ # Even so, the returned value is the string text from the first such node.
+ #
+ # Note also that the text note is retrieved by method get_text,
+ # and so is always normalized text.
+ #
+ # pkg:gem/rexml#lib/rexml/element.rb:1023
+ def text(path = T.unsafe(nil)); end
+
+ # :call-seq:
+ # text = string -> string
+ # text = nil -> nil
+ #
+ # Adds, replaces, or removes the first text node child in the element.
+ #
+ # With string argument +string+,
+ # creates a new \REXML::Text node containing that string,
+ # honoring the current settings for whitespace and row,
+ # then places the node as the first text child in the element;
+ # returns +string+.
+ #
+ # If the element has no text child, the text node is added:
+ #
+ # d = REXML::Document.new '