|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ozoneDB.xml.dom.CollectionImpl
Implements a live collection of elements. This collection is based on the
HTMLCollection
defined for HTML documents but works
with XML documents.
The collection is defined in terms of a root element and the elements to look for under this root. Only elements of the specified type are contained in the collection. Elements are returned by index or by identifier (the id attribute). The collection is live, meaning that changes to the document tree are immediately reflected in the collection. The collection is not optimized for traversing large document 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.
Used to implement both XMLCollection
and
HTMLAnchorElementImpl
. *
HTMLCollection
Constructor Summary | |
CollectionImpl(org.w3c.dom.Element topLevel)
Hidden constructor used by derived classes that might have different _lookfor properties. |
|
CollectionImpl(org.w3c.dom.Element topLevel,
java.lang.String lookFor)
Construct a new collection that retrieves element of the specific type (lookFor) from the specific document portion (topLevel). |
Method Summary | |
protected boolean |
collectionMatch(org.w3c.dom.Element elem,
java.lang.String name)
Determines if current element matches based on what we're looking for. |
int |
getLength()
Returns the length of the collection. |
org.w3c.dom.Node |
item(int index)
Retrieves the indexed node from the collection. |
org.w3c.dom.Node |
namedItem(java.lang.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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CollectionImpl(org.w3c.dom.Element topLevel, java.lang.String lookFor)
topLevel
- The element underneath which the collection existslookFor
- Tag of element to look forpublic CollectionImpl(org.w3c.dom.Element topLevel)
topLevel
- The element underneath which the collection existsMethod Detail |
public final int getLength()
getLength
in interface org.w3c.dom.html.HTMLCollection
public final org.w3c.dom.Node item(int index)
item
in interface org.w3c.dom.html.HTMLCollection
index
- The index of the node to return
public final org.w3c.dom.Node namedItem(java.lang.String name)
namedItem
in interface org.w3c.dom.html.HTMLCollection
name
- The name of the node to return
protected boolean recurse()
protected boolean collectionMatch(org.w3c.dom.Element elem, java.lang.String name)
elem
- The current elementname
- The identifier name or null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |