1 57 58 package org.enhydra.apache.xerces.dom; 59 60 import org.w3c.dom.DocumentType ; 61 import org.w3c.dom.NamedNodeMap ; 62 import org.w3c.dom.Node ; 63 64 87 public class DocumentTypeImpl 88 extends ParentNode 89 implements DocumentType { 90 91 95 96 static final long serialVersionUID = 7751299192316526485L; 97 98 102 103 protected String name; 104 105 106 protected NamedNodeMapImpl entities; 107 108 109 protected NamedNodeMapImpl notations; 110 111 113 114 protected NamedNodeMapImpl elements; 115 116 protected String publicID; 118 119 protected String systemID; 121 122 protected String internalSubset; 124 125 129 130 public DocumentTypeImpl(CoreDocumentImpl ownerDocument, String name) { 131 super(ownerDocument); 132 133 this.name = name; 134 entities = new NamedNodeMapImpl(this); 136 notations = new NamedNodeMapImpl(this); 137 138 elements = new NamedNodeMapImpl(this); 140 141 } 143 144 public DocumentTypeImpl(CoreDocumentImpl ownerDocument, 145 String qualifiedName, 146 String publicID, String systemID) { 147 this(ownerDocument, qualifiedName); 148 this.publicID = publicID; 149 this.systemID = systemID; 150 151 } 153 157 163 public String getPublicId() { 164 if (needsSyncData()) { 165 synchronizeData(); 166 } 167 return publicID; 168 } 169 175 public String getSystemId() { 176 if (needsSyncData()) { 177 synchronizeData(); 178 } 179 return systemID; 180 } 181 182 187 public void setInternalSubset(String internalSubset) { 188 if (needsSyncData()) { 189 synchronizeData(); 190 } 191 this.internalSubset = internalSubset; 192 } 193 194 200 public String getInternalSubset() { 201 if (needsSyncData()) { 202 synchronizeData(); 203 } 204 return internalSubset; 205 } 206 207 211 215 public short getNodeType() { 216 return Node.DOCUMENT_TYPE_NODE; 217 } 218 219 222 public String getNodeName() { 223 if (needsSyncData()) { 224 synchronizeData(); 225 } 226 return name; 227 } 228 229 230 public Node cloneNode(boolean deep) { 231 232 DocumentTypeImpl newnode = (DocumentTypeImpl)super.cloneNode(deep); 233 newnode.entities = entities.cloneMap(newnode); 235 newnode.notations = notations.cloneMap(newnode); 236 newnode.elements = elements.cloneMap(newnode); 237 newnode.internalSubset = internalSubset; 238 239 return newnode; 240 241 } 243 247 protected void setOwnerDocument(CoreDocumentImpl doc) { 248 super.setOwnerDocument(doc); 249 entities.setOwnerDocument(doc); 250 notations.setOwnerDocument(doc); 251 elements.setOwnerDocument(doc); 252 } 253 254 258 262 public String getName() { 263 264 if (needsSyncData()) { 265 synchronizeData(); 266 } 267 return name; 268 269 } 271 293 public NamedNodeMap getEntities() { 294 if (needsSyncChildren()) { 295 synchronizeChildren(); 296 } 297 return entities; 298 } 299 300 305 public NamedNodeMap getNotations() { 306 if (needsSyncChildren()) { 307 synchronizeChildren(); 308 } 309 return notations; 310 } 311 312 316 321 public void setReadOnly(boolean readOnly, boolean deep) { 322 323 if (needsSyncChildren()) { 324 synchronizeChildren(); 325 } 326 super.setReadOnly(readOnly, deep); 327 328 elements.setReadOnly(readOnly, true); 330 entities.setReadOnly(readOnly, true); 331 notations.setReadOnly(readOnly, true); 332 333 } 335 339 public NamedNodeMap getElements() { 340 if (needsSyncChildren()) { 341 synchronizeChildren(); 342 } 343 return elements; 344 } 345 346 } | Popular Tags |