Ruby REXML::Document Functions

EditRocket provides the following information on REXML::Document functions in the Ruby source code builder.

add( child ) - We override this, because XMLDecls and DocTypes must go at the start of the document

add_element(arg=nil, arg2=nil) -

clone() - Should be obvious

doctype() - "@return the DocType child of the document, if one exists, and nil otherwise."

encoding() - "@return the XMLDecl encoding of this document as a String. If no XMLDecl has been set, returns the default encoding."

expanded_name() - According to the XML spec, a root node has no expanded name

name() - "Alias for #expanded_name"

new( source = nil, context = {} ) - Constructor @param source if supplied, must be a Document, String, or IO. Documents have their context and Element attributes cloned. Strings are expected to be valid XML documents. IOs are expected to be sources of valid XML documents. @param context if supplied, contains the context of the document; this should be a Hash.

node_type() -

parse_stream( source, listener ) -

root() - "@return the root Element of the document, or nil if this document has no children."

stand_alone?() - "@return the XMLDecl standalone value of this document as a String. If no XMLDecl has been set, returns the default setting."

version() - "@return the XMLDecl version of this document as a String. If no XMLDecl has been set, returns the default version."

write( output=$stdout, indent=-1, transitive=false, ie_hack=false ) - Write the XML tree out, optionally with indent. This writes out the entire XML document, including XML declarations, doctype declarations, and processing instructions (if any are given).

xml_decl() - "@return the XMLDecl of this document; if no XMLDecl has been set, the default declaration is returned."