1 57 58 package org.enhydra.apache.xerces.dom; 59 60 import org.enhydra.apache.xerces.utils.StringPool; 61 import org.w3c.dom.Node ; 62 63 83 public class DeferredDocumentTypeImpl 84 extends DocumentTypeImpl 85 implements DeferredNode { 86 87 91 92 static final long serialVersionUID = -2172579663227313509L; 93 94 98 99 protected transient int fNodeIndex; 100 101 105 109 DeferredDocumentTypeImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) { 110 super(ownerDocument, null); 111 112 fNodeIndex = nodeIndex; 113 needsSyncData(true); 114 needsSyncChildren(true); 115 116 } 118 122 123 public int getNodeIndex() { 124 return fNodeIndex; 125 } 126 127 131 132 protected void synchronizeData() { 133 134 needsSyncData(false); 136 137 DeferredDocumentImpl ownerDocument = 139 (DeferredDocumentImpl)this.ownerDocument; 140 name = ownerDocument.getNodeNameString(fNodeIndex); 141 142 StringPool pool = ownerDocument.getStringPool(); 144 int extraDataIndex = ownerDocument.getNodeValue(fNodeIndex); 145 publicID = pool.toString(ownerDocument.getNodeName(extraDataIndex)); 147 systemID = pool.toString(ownerDocument.getNodeValue(extraDataIndex)); 148 internalSubset = 149 pool.toString(ownerDocument.getLastChild(extraDataIndex)); 150 } 152 153 protected void synchronizeChildren() { 154 155 boolean orig = ownerDocument().getMutationEvents(); 157 ownerDocument().setMutationEvents(false); 158 159 needsSyncChildren(false); 161 162 DeferredDocumentImpl ownerDocument = 164 (DeferredDocumentImpl)this.ownerDocument; 165 166 entities = new NamedNodeMapImpl(this); 167 notations = new NamedNodeMapImpl(this); 168 elements = new NamedNodeMapImpl(this); 169 170 DeferredNode last = null; 172 for (int index = ownerDocument.getLastChild(fNodeIndex); 173 index != -1; 174 index = ownerDocument.getPrevSibling(index)) { 175 176 DeferredNode node = ownerDocument.getNodeObject(index); 177 int type = node.getNodeType(); 178 switch (type) { 179 180 case Node.ENTITY_NODE: { 182 entities.setNamedItem(node); 183 break; 184 } 185 186 case Node.NOTATION_NODE: { 188 notations.setNamedItem(node); 189 break; 190 } 191 192 case NodeImpl.ELEMENT_DEFINITION_NODE: { 194 elements.setNamedItem(node); 195 break; 196 } 197 198 case Node.ELEMENT_NODE: { 200 if (((DocumentImpl)getOwnerDocument()).allowGrammarAccess) { 201 insertBefore(node, last); 202 last = node; 203 break; 204 } 205 } 206 207 default: { 209 System.out.println("DeferredDocumentTypeImpl#synchronizeInfo: node.getNodeType() = "+node.getNodeType()+", class = "+node.getClass().getName()); 210 } 211 } 212 } 213 214 ownerDocument().setMutationEvents(orig); 216 217 setReadOnly(true, false); 219 220 } 222 } | Popular Tags |