FileDocCategorySizeDatePackage
DTMDefaultBaseIterators.javaAPI DocJava SE 5 API56551Fri Aug 26 14:56:00 BST 2005com.sun.org.apache.xml.internal.dtm.ref

DTMDefaultBaseIterators

public abstract class DTMDefaultBaseIterators extends DTMDefaultBaseTraversers
This class implements the traversers for DTMDefaultBase.

Fields Summary
Constructors Summary
public DTMDefaultBaseIterators(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing)
Construct a DTMDefaultBaseTraversers object from a DOM node.

param
mgr The DTMManager who owns this DTM.
param
domSource the DOM source that this DTM will wrap.
param
source The object that is used to specify the construction source.
param
dtmIdentity The DTM identity ID for this DTM.
param
whiteSpaceFilter The white space filter for this DTM, which may be null.
param
xstringfactory The factory to use for creating XMLStrings.
param
doIndexing true if the caller considers it worth it to use indexing schemes.

    super(mgr, source, dtmIdentity, whiteSpaceFilter, 
          xstringfactory, doIndexing);
  
public DTMDefaultBaseIterators(DTMManager mgr, Source source, int dtmIdentity, DTMWSFilter whiteSpaceFilter, XMLStringFactory xstringfactory, boolean doIndexing, int blocksize, boolean usePrevsib, boolean newNameTable)
Construct a DTMDefaultBaseTraversers object from a DOM node.

param
mgr The DTMManager who owns this DTM.
param
domSource the DOM source that this DTM will wrap.
param
source The object that is used to specify the construction source.
param
dtmIdentity The DTM identity ID for this DTM.
param
whiteSpaceFilter The white space filter for this DTM, which may be null.
param
xstringfactory The factory to use for creating XMLStrings.
param
doIndexing true if the caller considers it worth it to use indexing schemes.
param
blocksize The block size of the DTM.
param
usePrevsib true if we want to build the previous sibling node array.
param
newNameTable true if we want to use a new ExpandedNameTable for this DTM.

    super(mgr, source, dtmIdentity, whiteSpaceFilter, 
          xstringfactory, doIndexing, blocksize, usePrevsib, newNameTable);
  
Methods Summary
public com.sun.org.apache.xml.internal.dtm.DTMAxisIteratorgetAxisIterator(int axis)
This is a shortcut to the iterators that implement the XPath axes. Returns a bare-bones iterator that must be initialized with a start node (using iterator.setStartNode()).

param
axis One of Axes.ANCESTORORSELF, etc.
return
A DTMAxisIterator, or null if the given axis isn't supported.


    DTMAxisIterator iterator = null;

    switch (axis)
    {
    case Axis.SELF :
      iterator = new SingletonIterator();
      break;
    case Axis.CHILD :
      iterator = new ChildrenIterator();
      break;
    case Axis.PARENT :
      return (new ParentIterator());
    case Axis.ANCESTOR :
      return (new AncestorIterator());
    case Axis.ANCESTORORSELF :
      return ((new AncestorIterator()).includeSelf());
    case Axis.ATTRIBUTE :
      return (new AttributeIterator());
    case Axis.DESCENDANT :
      iterator = new DescendantIterator();
      break;
    case Axis.DESCENDANTORSELF :
      iterator = (new DescendantIterator()).includeSelf();
      break;
    case Axis.FOLLOWING :
      iterator = new FollowingIterator();
      break;
    case Axis.PRECEDING :
      iterator = new PrecedingIterator();
      break;
    case Axis.FOLLOWINGSIBLING :
      iterator = new FollowingSiblingIterator();
      break;
    case Axis.PRECEDINGSIBLING :
      iterator = new PrecedingSiblingIterator();
      break;
    case Axis.NAMESPACE :
      iterator = new NamespaceIterator();
      break;
    case Axis.ROOT :
      iterator = new RootIterator();
      break;
    default :
      throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_AXIS_NOT_IMPLEMENTED, new Object[]{Axis.names[axis]})); //"Error: iterator for axis '" + Axis.names[axis]
                             //+ "' not implemented");
    }

    return (iterator);
  
public com.sun.org.apache.xml.internal.dtm.DTMAxisIteratorgetTypedAxisIterator(int axis, int type)
Get an iterator that can navigate over an XPath Axis, predicated by the extended type ID. Returns an iterator that must be initialized with a start node (using iterator.setStartNode()).

param
axis One of Axes.ANCESTORORSELF, etc.
param
type An extended type ID.
return
A DTMAxisIterator, or null if the given axis isn't supported.


    DTMAxisIterator iterator = null;

    /* This causes an error when using patterns for elements that
       do not exist in the DOM (translet types which do not correspond
       to a DOM type are mapped to the DOM.ELEMENT type).
    */

    //        if (type == NO_TYPE) {
    //            return(EMPTYITERATOR);
    //        }
    //        else if (type == ELEMENT) {
    //            iterator = new FilterIterator(getAxisIterator(axis),
    //                                          getElementFilter());
    //        }
    //        else 
    {
      switch (axis)
      {
      case Axis.SELF :
        iterator = new TypedSingletonIterator(type);
        break;
      case Axis.CHILD :
        iterator = new TypedChildrenIterator(type);
        break;
      case Axis.PARENT :
        return (new ParentIterator().setNodeType(type));
      case Axis.ANCESTOR :
        return (new TypedAncestorIterator(type));
      case Axis.ANCESTORORSELF :
        return ((new TypedAncestorIterator(type)).includeSelf());
      case Axis.ATTRIBUTE :
        return (new TypedAttributeIterator(type));
      case Axis.DESCENDANT :
        iterator = new TypedDescendantIterator(type);
        break;
      case Axis.DESCENDANTORSELF :
        iterator = (new TypedDescendantIterator(type)).includeSelf();
        break;
      case Axis.FOLLOWING :
        iterator = new TypedFollowingIterator(type);
        break;
      case Axis.PRECEDING :
        iterator = new TypedPrecedingIterator(type);
        break;
      case Axis.FOLLOWINGSIBLING :
        iterator = new TypedFollowingSiblingIterator(type);
        break;
      case Axis.PRECEDINGSIBLING :
        iterator = new TypedPrecedingSiblingIterator(type);
        break;
      case Axis.NAMESPACE :
        iterator = new TypedNamespaceIterator(type);
        break;
      case Axis.ROOT :
        iterator = new TypedRootIterator(type);
        break;
      default :
        throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED, new Object[]{Axis.names[axis]})); //"Error: typed iterator for axis "
                               //+ Axis.names[axis] + "not implemented");
      }
    }

    return (iterator);