@Override public NodeIterator createNodeIterator(Node root,int whatToShow,NodeFilter filter,boolean entityReferenceExpansion){
  if (root == null) {
    String msg=DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,"NOT_SUPPORTED_ERR",null);
    throw new DOMException(DOMException.NOT_SUPPORTED_ERR,msg);
  }
  NodeIterator iterator=new NodeIteratorImpl(this,root,whatToShow,filter,entityReferenceExpansion);
  if (iterators == null) {
    iterators=new LinkedList();
    iteratorReferenceQueue=new ReferenceQueue();
  }
  removeStaleIteratorReferences();
  iterators.add(new WeakReference(iterator,iteratorReferenceQueue));
  return iterator;
}

@ Override public NodeIterator createNodeIterator ( Node root , int whatToShow , NodeFilter filter , boolean entityReferenceExpansion ) { if ( root == null ) { String msg = DOMMessageFormatter . formatMessage ( DOMMessageFormatter . DOM_DOMAIN , "NOT_SUPPORTED_ERR" , null ) ; throw new DOMException ( DOMException . NOT_SUPPORTED_ERR , msg ) ; } NodeIterator iterator = new NodeIteratorImpl ( this , root , whatToShow , filter , entityReferenceExpansion ) ; if ( iterators == null ) { iterators = new LinkedList ( ) ; iteratorReferenceQueue = new ReferenceQueue ( ) ; } removeStaleIteratorReferences ( ) ; iterators . add ( new WeakReference ( iterator , iteratorReferenceQueue ) ) ; return iterator ; }
create and return a nodeiterator . the nodeiterator is added to a list of nodeiterators so that it can be removed to free up the dom nodes it references .
