1 57 58 59 60 61 66 67 package org.enhydra.apache.xerces.dom; 68 69 import org.enhydra.apache.xerces.utils.StringPool; 70 import org.w3c.dom.NamedNodeMap ; 71 72 77 public class DeferredElementNSImpl 78 extends ElementNSImpl 79 implements DeferredNode { 80 81 85 86 static final long serialVersionUID = -5001885145370927385L; 87 88 92 93 protected transient int fNodeIndex; 94 95 99 103 DeferredElementNSImpl(DeferredDocumentImpl ownerDoc, int nodeIndex) { 104 super(ownerDoc, null); 105 106 fNodeIndex = nodeIndex; 107 needsSyncChildren(true); 108 109 } 111 115 116 public final int getNodeIndex() { 117 return fNodeIndex; 118 } 119 120 124 125 protected final void synchronizeData() { 126 127 needsSyncData(false); 129 130 DeferredDocumentImpl ownerDocument = 132 (DeferredDocumentImpl) this.ownerDocument; 133 134 boolean orig = ownerDocument.mutationEvents; 136 ownerDocument.mutationEvents = false; 137 138 int elementQName = ownerDocument.getNodeName(fNodeIndex); 139 StringPool pool = ownerDocument.getStringPool(); 140 name = pool.toString(elementQName); 141 142 int index = name.indexOf(':'); 144 if (index < 0) { 145 localName = name; 146 } 147 else { 148 localName = name.substring(index + 1); 149 } 150 151 namespaceURI = pool.toString(ownerDocument.getNodeURI(fNodeIndex)); 152 if (namespaceURI.length() == 0) { 154 namespaceURI = null; 155 } 156 157 setupDefaultAttributes(); 159 int attrIndex = ownerDocument.getNodeValue(fNodeIndex); 160 if (attrIndex != -1) { 161 NamedNodeMap attrs = getAttributes(); 162 do { 163 NodeImpl attr = 164 (NodeImpl)ownerDocument.getNodeObject(attrIndex); 165 attrs.setNamedItem(attr); 166 attrIndex = ownerDocument.getPrevSibling(attrIndex); 167 } while (attrIndex != -1); 168 } 169 170 ownerDocument.mutationEvents = orig; 172 173 } 175 181 protected final void synchronizeChildren() { 182 DeferredDocumentImpl ownerDocument = 183 (DeferredDocumentImpl) ownerDocument(); 184 ownerDocument.synchronizeChildren(this, fNodeIndex); 185 } 187 } | Popular Tags |