Class HTMLTree::Element
In: lib/html/element.rb
lib/html/xpath.rb
lib/html/element.rb
lib/html/xpath.rb
Parent: Object

This is a TreeElement that represents tagged items in an HTML document.

Methods

Included Modules

TreeElement TreeElement

Public Class methods

parent_or_nil:TreeElement or nil
tag_name:String
parent_or_nil:TreeElement or nil
tag_name:String

Public Instance methods

Return the value of a single attribute (a String or Array).

Return the value of a single attribute (a String or Array).

Append an attribute. values are first flattened into an Array, then converted into strings.

If there is a single attribute value, it will appear as a String, otherwise it will be an Array of Strings.

Example:

  element.add_attribute("width", "123")
  element.add_attribute("value", [ "a", "b" ])

Append an attribute. values are first flattened into an Array, then converted into strings.

If there is a single attribute value, it will appear as a String, otherwise it will be an Array of Strings.

Example:

  element.add_attribute("width", "123")
  element.add_attribute("value", [ "a", "b" ])

convert the given HTMLTree::Element (or HTMLTree::Document) into a REXML::Element or REXML::Document, ready to use REXML::XPath on. Note that this caches the tree; further changes to my tree will not be reflected in subsequent calls

convert the given HTMLTree::Element (or HTMLTree::Document) into a REXML::Element or REXML::Document, ready to use REXML::XPath on. Note that this caches the tree; further changes to my tree will not be reflected in subsequent calls

Return the value of a single attribute (a String or Array).

Return the value of a single attribute (a String or Array).

Return the order of my attributes

Return the order of my attributes

Return my attributes Hash.

Return my attributes Hash.

Return true if I‘m data instead of a tag

Return true if I‘m data instead of a tag

Return the children of this node that are elements (not data)

Return the children of this node that are elements (not data)

Return the path to this element from the root

Return the path to this element from the root

Return my tag (should be a String)

Return my tag (should be a String)

Return an HTML::Tag for further information, or nil if this is an unknown tag.

Return an HTML::Tag for further information, or nil if this is an unknown tag.

Print me (and my descendents) on the given IO stream.

Print me (and my descendents) on the given IO stream.

[Validate]