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 / parser / ElementDeclEnumeration.java < prev    next >
Encoding:
Java Source  |  1997-10-20  |  1.7 KB  |  68 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.parser;
  9.  
  10. import com.ms.xml.om.Element;
  11. import com.ms.xml.util.Name;
  12. import java.util.Enumeration;
  13.  
  14.  
  15. /**
  16.  * A simple Enumeration for iterating over Element declarations.
  17.  * Returns the XML-DATA specification for each element.
  18.  * This is DTD information represented in an XML Object Model.
  19.  * See <a href="http://www.microsoft.com/standards/xml/xmldata.htm">Specification for XML-Data</a> for details.
  20.  *
  21.  * @version 1.0, 8/25/97
  22.  * @see ElementDecl
  23.  * @see Name
  24.  */
  25. public class ElementDeclEnumeration implements Enumeration
  26. {
  27.     /**
  28.      * Creates new enumerator for enumerating over all of the children
  29.      * of the given root node.
  30.      */
  31.     public ElementDeclEnumeration(Enumeration elemDecls)
  32.     {
  33.         this.elemDecls = elemDecls;
  34.     }
  35.  
  36.     /**
  37.      * Creates new enumerator for enumerating over all of the children
  38.      * of the given root node.
  39.      */
  40.     public ElementDeclEnumeration(Element e)
  41.     {
  42.         this.elemDecls = (e != null) ? e.getElements() : null;
  43.     }
  44.  
  45.     /**
  46.      * Return whether or not there are any more matching elements.
  47.      * @return true if the next call to nextElement will return
  48.      * non null result.
  49.      */
  50.     public boolean hasMoreElements()
  51.     {
  52.         return elemDecls.hasMoreElements();
  53.     }
  54.  
  55.     /**
  56.      * Return the next matching element.
  57.      * @return Element or null of there are no more matching elements.
  58.      */
  59.     public Object nextElement()
  60.     {
  61.         Element elemDecl = (Element)elemDecls.nextElement();
  62.         
  63.         return elemDecl.toSchema();
  64.     }
  65.  
  66.     Enumeration elemDecls;
  67. }
  68.