1 57 58 package org.enhydra.apache.xerces.dom; 59 60 import org.w3c.dom.DocumentType ; 61 import org.w3c.dom.Entity ; 62 import org.w3c.dom.NamedNodeMap ; 63 import org.w3c.dom.Node ; 64 65 116 public class DeferredEntityReferenceImpl 117 extends EntityReferenceImpl 118 implements DeferredNode { 119 120 124 125 static final long serialVersionUID = 390319091370032223L; 126 127 131 132 protected transient int fNodeIndex; 133 134 138 142 DeferredEntityReferenceImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) { 143 super(ownerDocument, null); 144 145 fNodeIndex = nodeIndex; 146 needsSyncData(true); 147 needsSyncChildren(true); 148 149 } 151 155 156 public int getNodeIndex() { 157 return fNodeIndex; 158 } 159 160 164 168 protected void synchronizeData() { 169 170 needsSyncData(false); 172 173 DeferredDocumentImpl ownerDocument = (DeferredDocumentImpl)this.ownerDocument; 175 name = ownerDocument.getNodeNameString(fNodeIndex); 176 177 } 179 180 protected void synchronizeChildren() { 181 182 needsSyncChildren(false); 184 185 DocumentType doctype = ownerDocument.getDoctype(); 187 boolean found = false; 188 if (doctype != null) { 189 190 boolean orig = ownerDocument.getMutationEvents(); 192 ownerDocument.setMutationEvents(false); 193 194 NamedNodeMap entities = doctype.getEntities(); 195 if (entities != null) { 196 Entity entity = (Entity )entities.getNamedItem(getNodeName()); 197 if (entity != null) { 198 199 found = true; 201 202 boolean ro = isReadOnly(); 204 isReadOnly(false); 205 Node child = entity.getFirstChild(); 206 while (child != null) { 207 appendChild(child.cloneNode(true)); 208 child = child.getNextSibling(); 209 } 210 if (ro) { 212 setReadOnly(true, true); 213 } 214 } 215 } 216 ownerDocument.setMutationEvents(orig); 218 } 219 220 if (!found) { 222 isReadOnly(false); 223 DeferredDocumentImpl ownerDocument = 224 (DeferredDocumentImpl) ownerDocument(); 225 ownerDocument.synchronizeChildren(this, fNodeIndex); 226 setReadOnly(true, true); 227 } 228 229 } 231 protected void synchronize() { 233 } 234 235 } | Popular Tags |