1 16 17 package org.apache.xerces.dom; 18 19 import org.w3c.dom.Node ; 20 21 43 public class DeferredDocumentTypeImpl 44 extends DocumentTypeImpl 45 implements DeferredNode { 46 47 51 52 static final long serialVersionUID = -2172579663227313509L; 53 54 58 59 protected transient int fNodeIndex; 60 61 65 69 DeferredDocumentTypeImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) { 70 super(ownerDocument, null); 71 72 fNodeIndex = nodeIndex; 73 needsSyncData(true); 74 needsSyncChildren(true); 75 76 } 78 82 83 public int getNodeIndex() { 84 return fNodeIndex; 85 } 86 87 91 92 protected void synchronizeData() { 93 94 needsSyncData(false); 96 97 DeferredDocumentImpl ownerDocument = 99 (DeferredDocumentImpl)this.ownerDocument; 100 name = ownerDocument.getNodeName(fNodeIndex); 101 102 publicID = ownerDocument.getNodeValue(fNodeIndex); 104 systemID = ownerDocument.getNodeURI(fNodeIndex); 105 int extraDataIndex = ownerDocument.getNodeExtra(fNodeIndex); 106 internalSubset = ownerDocument.getNodeValue(extraDataIndex); 107 } 109 110 protected void synchronizeChildren() { 111 112 boolean orig = ownerDocument().getMutationEvents(); 114 ownerDocument().setMutationEvents(false); 115 116 needsSyncChildren(false); 118 119 DeferredDocumentImpl ownerDocument = 121 (DeferredDocumentImpl)this.ownerDocument; 122 123 entities = new NamedNodeMapImpl(this); 124 notations = new NamedNodeMapImpl(this); 125 elements = new NamedNodeMapImpl(this); 126 127 DeferredNode last = null; 129 for (int index = ownerDocument.getLastChild(fNodeIndex); 130 index != -1; 131 index = ownerDocument.getPrevSibling(index)) { 132 133 DeferredNode node = ownerDocument.getNodeObject(index); 134 int type = node.getNodeType(); 135 switch (type) { 136 137 case Node.ENTITY_NODE: { 139 entities.setNamedItem(node); 140 break; 141 } 142 143 case Node.NOTATION_NODE: { 145 notations.setNamedItem(node); 146 break; 147 } 148 149 case NodeImpl.ELEMENT_DEFINITION_NODE: { 151 elements.setNamedItem(node); 152 break; 153 } 154 155 case Node.ELEMENT_NODE: { 157 if (((DocumentImpl)getOwnerDocument()).allowGrammarAccess){ 158 insertBefore(node, last); 159 last = node; 160 break; 161 } 162 } 163 164 default: { 166 System.out.println("DeferredDocumentTypeImpl" + 167 "#synchronizeInfo: " + 168 "node.getNodeType() = " + 169 node.getNodeType() + 170 ", class = " + 171 node.getClass().getName()); 172 } 173 } 174 } 175 176 ownerDocument().setMutationEvents(orig); 178 179 setReadOnly(true, false); 181 182 } 184 } | Popular Tags |