method

add_namespace

v1_8_7_72 - Show latest stable - Class: REXML::Element
add_namespace( prefix, uri=nil )
public

Adds a namespace to this element.

prefix:the prefix string, or the namespace URI if uri is not supplied
uri:the namespace URI. May be nil, in which prefix is used as the URI

Evaluates to: this Element

 a = Element.new("a")
 a.add_namespace("xmlns:foo", "bar" )
 a.add_namespace("foo", "bar")  # shorthand for previous line
 a.add_namespace("twiddle")
 puts a   #-> <a xmlns:foo='bar' xmlns='twiddle'/>