1 18 package org.apache.batik.dom; 19 20 import org.w3c.dom.DOMException ; 21 import org.w3c.dom.Entity ; 22 import org.w3c.dom.Node ; 23 24 30 public abstract class AbstractEntity 31 extends AbstractParentNode 32 implements Entity { 33 36 protected String nodeName; 37 38 41 protected String publicId; 42 43 46 protected String systemId; 47 48 52 public short getNodeType() { 53 return ENTITY_NODE; 54 } 55 56 59 public void setNodeName(String v) { 60 nodeName = v; 61 } 62 63 67 public String getNodeName() { 68 return nodeName; 69 } 70 71 75 public String getPublicId() { 76 return publicId; 77 } 78 79 82 public void setPublicId(String id) { 83 publicId = id; 84 } 85 86 90 public String getSystemId() { 91 return systemId; 92 } 93 94 97 public void setSystemId(String id) { 98 systemId = id; 99 } 100 101 105 public String getNotationName() { 106 return getNodeName(); 107 } 108 109 112 public void setNotationName(String name) { 113 setNodeName(name); 114 } 115 116 119 protected Node export(Node n, AbstractDocument d) { 120 super.export(n, d); 121 AbstractEntity ae = (AbstractEntity)n; 122 ae.nodeName = nodeName; 123 ae.publicId = publicId; 124 ae.systemId = systemId; 125 return n; 126 } 127 128 131 protected Node deepExport(Node n, AbstractDocument d) { 132 super.deepExport(n, d); 133 AbstractEntity ae = (AbstractEntity)n; 134 ae.nodeName = nodeName; 135 ae.publicId = publicId; 136 ae.systemId = systemId; 137 return n; 138 } 139 140 144 protected Node copyInto(Node n) { 145 super.copyInto(n); 146 AbstractEntity ae = (AbstractEntity)n; 147 ae.nodeName = nodeName; 148 ae.publicId = publicId; 149 ae.systemId = systemId; 150 return n; 151 } 152 153 157 protected Node deepCopyInto(Node n) { 158 super.deepCopyInto(n); 159 AbstractEntity ae = (AbstractEntity)n; 160 ae.nodeName = nodeName; 161 ae.publicId = publicId; 162 ae.systemId = systemId; 163 return n; 164 } 165 166 169 protected void checkChildType(Node n, boolean replace) { 170 switch (n.getNodeType()) { 171 case ELEMENT_NODE: 172 case PROCESSING_INSTRUCTION_NODE: 173 case COMMENT_NODE: 174 case TEXT_NODE: 175 case CDATA_SECTION_NODE: 176 case ENTITY_REFERENCE_NODE: 177 case DOCUMENT_FRAGMENT_NODE: 178 break; 179 default: 180 throw createDOMException 181 (DOMException.HIERARCHY_REQUEST_ERR, 182 "child.type", 183 new Object [] { new Integer (getNodeType()), 184 getNodeName(), 185 new Integer (n.getNodeType()), 186 n.getNodeName() }); 187 } 188 } 189 } 190 | Popular Tags |