Module | HTree::Elem::Trav |
In: |
htree/elem.rb
htree/modules.rb htree/traverse.rb |
attributes returns attributes as a hash. The hash keys are HTree::Name objects. The hash values are HTree::Text or HTree::Location objects.
p HTree('<a name="xx" href="uu">').root.attributes # => {href=>{text "uu"}, name=>{text "xx"}} p HTree('<a name="xx" href="uu">').make_loc.root.attributes # => {href=>#<HTree::Location: doc()/a/@href>, name=>#<HTree::Location: doc()/a/@name>}
fetch_attr returns an attribute value as a string.
elem may be an instance of HTree::Elem or a location points to it.
fetch_attribute returns an attribute value as a text.
elem may be an instance of HTree::Elem or a location points to it.
qualified_name returns the qualified name of the element as a string.
p HTree('<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>').root.qualified_name # => "rdf:RDF"