add_namespace

add_namespace( prefix, uri=nil )
Instance Public methods

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'/>
doc_ruby_on_rails
2015-05-06 09:55:36
Comments
Leave a Comment

Please login to continue.