| java.lang.Object websphinx.Region websphinx.Element
All known Subclasses: websphinx.Link,
Element | public class Element extends Region (Code) | | Element in an HTML page. An element runs from a start tag
(like <ul>) to its matching end tag (</ul>),
inclusive.
An element may have an optional end tag (like <p>),
in which case the element runs up to (but not including)
the tag that implicitly closes it. For example:
<p>Paragraph 1<p>Paragraph 2
contains two elements, <p>Paragraph 1
and <p>Paragraph 2 .
|
Constructor Summary | |
public | Element(Tag startTag, Tag endTag) Make an Element from a start tag and end tag. | public | Element(Tag startTag, int end) Make an Element from a start tag and an end position. |
Element | public Element(Tag startTag, Tag endTag)(Code) | | Make an Element from a start tag and end tag. The tags
must be on the same Page.
Parameters: startTag - Start tag of element Parameters: endTag - End tag of element (may be null) |
Element | public Element(Tag startTag, int end)(Code) | | Make an Element from a start tag and an end position. Used
when the end tag has been omitted (like <p>, frequently).
Parameters: startTag - Start tag of element Parameters: end - Ending offset of element |
enumerateHTMLAttributes | public Enumeration enumerateHTMLAttributes()(Code) | | Enumerate the HTML attributes found on this tag.
enumeration of the attribute names found on this tag. |
getChild | public Element getChild()(Code) | | Get element's first child.
first element contained by this element, or null if no children. |
getEndTag | public Tag getEndTag()(Code) | | Get end tag.
end tag of element, or null if element has no end tag. |
getHTMLAttribute | public String getHTMLAttribute(String name)(Code) | | Get an HTML attribute's value.
Parameters: name - Name of HTML attribute (e.g. "HREF"). Doesn't have to beconverted with toHTMLAttributeName(). value of attribute if it exists, TRUE if the attribute exists but has no value, or null if tag lacks the attribute. |
getHTMLAttribute | public String getHTMLAttribute(String name, String defaultValue)(Code) | | Get an HTML attribute's value, with a default value if it doesn't exist.
Parameters: name - Name of HTML attribute (e.g. "HREF"). Doesn't have to beconverted with toHTMLAttributeName(). Parameters: defaultValue - default value to return if the attribute doesn't exist value of attribute if it exists, TRUE if the attribute exists but has no value, or defaultValue if tag lacks the attribute. |
getNext | public Element getNext()(Code) | | Return next element in an inorder walk of the tree,
assuming this element and its children have been visited.
next element |
getParent | public Element getParent()(Code) | | Get element's parent.
element that contains this element, or null if at top-level. |
getSibling | public Element getSibling()(Code) | | Get element's next sibling.
element that follows this element, or null if at end of parent's children. |
getStartTag | public Tag getStartTag()(Code) | | Get start tag.
start tag of element |
getTagName | public String getTagName()(Code) | | Get tag name.
tag name (like "p"), in lower-case, String.intern()'ed form.Thus you can compare tag names with ==, as in: getTagName() == Tag.IMG . |
hasHTMLAttribute | public boolean hasHTMLAttribute(String name)(Code) | | Test if tag has an HTML attribute.
Parameters: name - Name of HTML attribute (e.g. "HREF"). Doesn't have to beconverted with toHTMLAttributeName(). true if tag has the attribute, false if not |
|
|