home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML in Action / Dynamicke-HTML-v-akci-covermount.bin / XML / PARSER / XMLINST.EXE / classes / com / ms / xml / om / ElementDeclEnumeration.java < prev    next >
Encoding:
Java Source  |  1997-08-26  |  1.5 KB  |  63 lines

  1. /*
  2.  * @(#)ElementDeclEnumeration.java 1.0 8/25/97
  3.  * 
  4.  * Copyright (c) 1997 Microsoft, Corp. All Rights Reserved.
  5.  * 
  6.  */
  7.  
  8. package com.ms.xml.om;
  9.  
  10. import com.ms.xml.util.Name;
  11. import java.util.Enumeration;
  12.  
  13. /**
  14.  * A simple Enumeration for iterating over ElementDecls
  15.  *
  16.  * @version 1.0, 8/25/97
  17.  * @see ElementDecl
  18.  * @see Name
  19.  */
  20. public class ElementDeclEnumeration implements Enumeration
  21. {
  22.     /**
  23.      * Creates new enumerator for enumerating over all of the children
  24.      * of the given root node.
  25.      */
  26.     public ElementDeclEnumeration(Enumeration elemDecls)
  27.     {
  28.         this.elemDecls = elemDecls;
  29.     }
  30.  
  31.     /**
  32.      * Creates new enumerator for enumerating over all of the children
  33.      * of the given root node.
  34.      */
  35.     public ElementDeclEnumeration(Element e)
  36.     {
  37.         this.elemDecls = (e != null) ? e.getElements() : null;
  38.     }
  39.  
  40.     /**
  41.      * Return whether or not there are any more matching elements.
  42.      * @return true if the next call to nextElement will return
  43.      * non null result.
  44.      */
  45.     public boolean hasMoreElements()
  46.     {
  47.         return elemDecls.hasMoreElements();
  48.     }
  49.  
  50.     /**
  51.      * Return the next matching element.
  52.      * @return Element or null of there are no more matching elements.
  53.      */
  54.     public Object nextElement()
  55.     {
  56.         Element elemDecl = (Element)elemDecls.nextElement();
  57.         
  58.         return elemDecl.toSchema();
  59.     }
  60.  
  61.     Enumeration elemDecls;
  62. }
  63.