1
23package org.jzuul.dtdparser;
24
25import java.util.ArrayList;
26import java.util.HashMap;
27import java.util.Iterator;
28import java.util.List;
29import java.util.Map;
30
31
32
40public class DTDElement extends DTDEntry {
41 public static final int EMPTY = 10;
42 public static final int PCDATA = 20;
43 public static final int ELEMENT = 30;
44
45 protected Map children, attributes;
46 protected int type;
47
48 public DTDElement(String name) {
49 super(name);
50 children = new HashMap();
51 attributes = new HashMap();
52 }
53
54 public List getChildElements() {
55 return new ArrayList(children.values());
56 }
57
58 public DTDTreeElement getChildElement(String name) {
59 return (DTDTreeElement)children.get(name);
60 }
61
62 public List getAttributes() {
63 return new ArrayList(attributes.values());
64 }
65
66 public DTDAttribute getAttribute(String name) {
67 return null;
68 }
69
70 public void addAttribute(DTDAttribute at) {
71 attributes.put(at.getName(), at);
72 }
73
74 public void setType(int type) {
75 this.type = type;
76 }
77
78 public void addChild(DTDElement child) {
79 this.children.put(child.getName(),child);
80 }
81
82 public void mergeSubElements(DTDElement originElement) {
83 List child = originElement.getChildElements();
84 for (Iterator iter = child.iterator(); iter.hasNext();) {
85 DTDElement element = (DTDElement) iter.next();
86 this.addChild(element);
87 }
88 }
89
90}
91