namespace

namespace(prefix=nil)
Instance Public methods

Evalutas to the URI for a prefix, or the empty string if no such namespace is declared for this element. Evaluates recursively for ancestors. Returns the default namespace, if there is one.

prefix

the prefix to search for. If not supplied, returns the default namespace if one exists

Returns

the namespace URI as a String, or nil if no such namespace exists. If the namespace is undefined, returns an empty string

doc = Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>")
b = doc.elements['//b']
b.namespace           # -> '1'
b.namespace("y")      # -> '2'
doc_ruby_on_rails
2015-05-06 11:07:35
Comments
Leave a Comment

Please login to continue.