Class ElementEnumeration

public class ElementEnumeration implements >Enumeration
{
  // Constructors
  public ElementEnumeration(Element root);
  public ElementEnumeration(Element root, Name tag, int type);

  // Methods
  public boolean hasMoreElements();
  public Object nextElement();
  public void reset();
}

This class is a simple Enumeration for iterating over the immediate children of a given node in the XML tree. This is not a hierarchical iterator. It does not walk the entire tree.

Also see Element, Name

Constructors

ElementEnumeration

public ElementEnumeration(Element root);

Creates a new enumerator for enumerating over all of the children of the given root node.

ParameterDescription
rootThe element whose children are going to be enumerated.

ElementEnumeration

public ElementEnumeration(Element root, Name tag, int type);

Creates a new enumerator for enumerating over the immediate children of the given root node that have matching tag names and/or types.

ParameterDescription
rootThe element whose children are going to be enumerated.
tagThe name of the tag; this parameter can be null if the name is not important.
typeThe element type. Element.ELEMENT is the most common. If the element type is not important, pass -1.

Methods

hasMoreElements 

public boolean hasMoreElements();

Determines if there are any more matching elements.

Return Value

Returns true if the next call to nextElement will return a non-null result.

nextElement 

public Object nextElement();

Retrieves the next matching element.

Return Value

Returns Element or null if there are no more matching elements.

reset 

public void reset();

Resets the iterator so that you can iterate through the elements again.

Return Value

No return value.