prefixes()
public
Returns an array of Strings containing all of the prefixes declared by this set of
# attributes. The array does not include the default namespace
declaration, if one exists. doc = Document.new(“<a xmlns=‘foo’
xmlns:x=‘bar’ xmlns:y=‘twee’ ”+
"z='glorp' p:k='gru'/>")
prefixes =
doc.root.attributes.prefixes
#-> [‘x’, ‘y’]
Show source
def prefixes
ns = []
each_attribute do |attribute|
ns << attribute.name if attribute.prefix == 'xmlns'
end
if @element.document and @element.document.doctype
expn = @element.expanded_name
expn = @element.document.doctype.name if expn.size == 0
@element.document.doctype.attributes_of(expn).each {
|attribute|
ns << attribute.name if attribute.prefix == 'xmlns'
}
end
ns
end