Module HTree::Elem::Trav
In: htree/elem.rb
htree/modules.rb
htree/traverse.rb

Methods

Included Modules

Container::Trav

Public Instance methods

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>}

name returns the universal name of the element as a string.

  p HTree('<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>').root.name
  # =>
  "{http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF"

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"

[Validate]