Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.xml.om   Previous This
Package
Next

 


Class ElementCollection

public class ElementCollection
{
  // Constructors
  public ElementCollection(Element root);
  public ElementCollection(Element root, Name tag, int type);

  // Methods
  public Element getChild(int index);
  public int getLength();
  public Object item(String name);
  public Element item(String name, int index);
}

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

Constructors

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.

ParameterDescription
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.

Methods

getChild

public Element getChild(int index);

Retrieves a specified item from the collection by index.

Return Value:

Returns the requested child node; returns null if not found.

ParameterDescription
index The index of the item in the element collection.

getLength

public int getLength();

Retrieves the number of items in the collection.

Return Value:

Returns the item count.

item

public Object item(String name);

Retrieves a named item or a collection of matching items.

Return Value:

Returns the requested item. Possible types of objects returned are Element, ElementCollection, or null.

ParameterDescription
name The name of the item or collection of matching items.

item

public Element item(String name, int index);

Retrieves a specified item from the collection of matching items.

Return Value:

Returns the requested item if it is found; returns null if it is not found.

ParameterDescription
name The name of the matching items.
index The index of the specific matching item to return.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.