home *** CD-ROM | disk | FTP | other *** search
- package com.ms.xml.om;
-
- import com.ms.xml.util.Name;
- import java.util.Enumeration;
-
- public class ElementEnumeration implements Enumeration {
- Element root;
- Enumeration children;
- Name tag;
- Element next;
- int type;
-
- public Object nextElement() {
- if (this.next != null) {
- Element var1 = this.next;
- this.next = null;
- return var1;
- } else {
- return this.getNext();
- }
- }
-
- public void reset() {
- this.children = this.root != null ? this.root.getElements() : null;
- this.next = null;
- }
-
- public ElementEnumeration(Element var1) {
- this.root = var1;
- this.tag = null;
- this.next = null;
- this.children = var1 != null ? var1.getElements() : null;
- this.type = -1;
- }
-
- public ElementEnumeration(Element var1, Name var2, int var3) {
- this.root = var1;
- this.tag = var2;
- this.next = null;
- this.children = var1 != null ? var1.getElements() : null;
- this.type = var3;
- }
-
- Element getNext() {
- if (this.children != null) {
- while(this.children.hasMoreElements()) {
- Element var1 = (Element)this.children.nextElement();
- if (this.tag == null && this.type == -1) {
- return var1;
- }
-
- if ((this.type == -1 || var1.getType() == this.type) && (this.tag == null || var1.getTagName() == this.tag)) {
- return var1;
- }
- }
- }
-
- return null;
- }
-
- public boolean hasMoreElements() {
- if (this.next == null) {
- this.next = this.getNext();
- }
-
- return this.next != null;
- }
- }
-