Open SiteSearch 4.1.1
Final

ORG.oclc.xml.om
Class ElementCollection

java.lang.Object
  |
  +--ORG.oclc.xml.om.ElementCollection

public class ElementCollection
extends Object

This class provides a collection interface to elements similar to the element collections found in the Internet Explorer 4.0 Dynamic HTML object model.


Constructor Summary
ElementCollection(Element root)
          Creates new collection object for given element.
ElementCollection(Element root, Name tag, int type)
          Creates a new collection for iterating over the immediate children of the given root node that have matching tag names and/or element types.
 
Method Summary
 Element getChild(int index)
          Retrieves a specified item from the collection by index.
 int getLength()
          Retrieves the number of items in the collection.
 Object item(String name)
          Retrieves a named item or a collection of matching items.
 Element item(String name, int index)
          Retrieves a specified item from the collection of matching items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementCollection

public ElementCollection(Element root)
Creates new collection object for given element.

ElementCollection

public ElementCollection(Element root,
                         Name tag,
                         int type)
Creates a new collection for iterating over the immediate children of the given root node that have matching tag names and/or element types.
Parameters:
root - The root to form the collection around.
tag - The name of the tag; this parameter can be null if the name is not important.
type - The element type. Element.ELEMENT is the most common. If the element type is not important, pass -1.
Method Detail

getLength

public int getLength()
Retrieves the number of items in the collection.
Returns:
the item count.

item

public Object item(String name)
Retrieves a named item or a collection of matching items.
Parameters:
name - The name of the item or collection of matching items.
Returns:
the requested item. Possible types of objects returned are Element, ElementCollection, or null.

getChild

public Element getChild(int index)
Retrieves a specified item from the collection by index.
Parameters:
index - The index of the item in the element collection.
Returns:
the requested child node; returns null if not found.

item

public Element item(String name,
                    int index)
Retrieves a specified item from the collection of matching items.
Parameters:
name - The name of the matching items.
index - The index of the specific matching item to return.
Returns:
the requested item if it is found; returns null if it is not found.

Open SiteSearch 4.1.1
Final