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
 puts a   #-> <a xmlns:foo='bar' xmlns='twiddle'/>
Show source
Register or log in to add new notes.