|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.xml.xhtml.dom.xerces.XHTMLCollectionImpl
Implements HTMLCollection
to traverse any named
elements on a HTMLDocument
. The elements type to
look for is identified in the constructor by code. This collection is not
optimized for traversing large trees.
The collection has to meet two requirements: it has to be live, and it has
to traverse depth first and always return results in that order. As such,
using an object container (such as Vector
) is expensive on
insert/remove operations. Instead, the collection has been implemented using
three traversing functions. As a result, operations on large documents will
result in traversal of the entire document tree and consume a considerable
amount of time.
Note that synchronization on the traversed document cannot be achieved. The document itself cannot be locked, and locking each traversed node is likely to lead to a dead lock condition. Therefore, there is a chance of the document being changed as results are fetched; in all likelihood, the results might be out dated, but not erroneous.
HTMLCollection
Field Summary | |
(package private) static short |
ANCHOR
Request collection of all anchors in document: <A> elements that have a name attribute. |
(package private) static short |
APPLET
Request collection of all Applets in document: <APPLET> and <OBJECT> elements (<OBJECT> must contain an Applet). |
(package private) static short |
AREA
Request collection of all areas in map: <AREA> element in <MAP> (non recursive). |
(package private) static short |
CELL
Request collection of all cells in row: <TD> elements in <TR> (non recursive). |
(package private) static short |
ELEMENT
Request collection of all form elements: <INPUT>, <BUTTON>, <SELECT>, <TEXT> and <TEXTAREA> elements inside form <FORM>. |
(package private) static short |
FORM
Request collection of all forms in document: <FORM> elements. |
(package private) static short |
IMAGE
Request collection of all images in document: <IMAGE> elements. |
(package private) static short |
LINK
Request collection of all links in document: <A> and <AREA> elements (must have a href attribute). |
(package private) static short |
OPTION
Request collection of all options in selection: <OPTION> elments in <SELECT> or <OPTGROUP>. |
(package private) static short |
ROW
Request collection of all rows in table: <TR> elements in table or table section. |
(package private) static short |
TBODY
Request collection of all table bodies in table: <TBODY> element in table <TABLE> (non recursive). |
Constructor Summary | |
(package private) |
XHTMLCollectionImpl(HTMLElement topLevel,
short lookingFor)
Construct a new collection that retrieves element of the specific type ( lookingFor ) from the specific document portion
(topLevel ). |
Method Summary | |
protected boolean |
collectionMatch(Element elem,
String name)
Determines if current element matches based on what we're looking for. |
int |
getLength()
Returns the length of the collection. |
Node |
item(int index)
Retrieves the indexed node from the collection. |
Node |
namedItem(String name)
Retrieves the named node from the collection. |
protected boolean |
recurse()
Returns true if scanning methods should iterate through the collection. |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final short ANCHOR
name
attribute.static final short FORM
static final short IMAGE
static final short APPLET
static final short LINK
href
attribute).static final short OPTION
static final short ROW
static final short ELEMENT
static final short AREA
static final short TBODY
static final short CELL
Constructor Detail |
XHTMLCollectionImpl(HTMLElement topLevel, short lookingFor)
lookingFor
) from the specific document portion
(topLevel
).topLevel
- The element underneath which the collection existslookingFor
- Code indicating what elements to look forMethod Detail |
public final int getLength()
getLength
in interface HTMLCollection
public final Node item(int index)
item
in interface HTMLCollection
index
- The index of the node to returnpublic final Node namedItem(String name)
namedItem
in interface HTMLCollection
name
- The name of the node to returnprotected boolean recurse()
protected boolean collectionMatch(Element elem, String name)
id
attribute
(match name
first for anchors).elem
- The current elementname
- The identifier name or null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |