class REXML::Element
def get_text path = nil
d.root.get_text(1) # => "this is bold!"
that matches +xpath+:
With argument +xpath+, returns the first text node from the element
d.root.get_text # => "some text "
d.root.get_text.class # => REXML::Text
d = REXML::Document.new "
some text this is bold! more text
"With no argument, returns the first text node from +self+:
+nil+ otherwise.
Returns the first text node child in a specified element, if it exists,
get_text(xpath = nil) -> text_node or nil
:call-seq:
def get_text path = nil rv = nil if path element = @elements[ path ] rv = element.get_text unless element.nil? else rv = @children.find { |node| node.kind_of? Text } end return rv end