/** * Returns the prev sibling of the given node. * This is post-normalization of Text Nodes. */ public int getPrevSibling(int nodeIndex) { return getPrevSibling(nodeIndex, true); }
/** * Returns internal Xerces details about all elements in the specified document. * The id of the returned {@link Map} is the {@code nodeIndex} of an element, and the list * is the array of ordered attributes names. * @param document the document * @return the map of an element index with its ordered attribute names */ public static Map<Integer, List<String>> getAttributesOrderMap(final Document document) { final Map<Integer, List<String>> map = new HashMap<>(); if (document instanceof DeferredDocumentImpl) { final DeferredDocumentImpl deferredDocument = (DeferredDocumentImpl) document; final int fNodeCount = getPrivate(deferredDocument, "fNodeCount"); for (int i = 0; i < fNodeCount; i++) { final int type = deferredDocument.getNodeType(i, false); if (type == org.w3c.dom.Node.ELEMENT_NODE) { int attrIndex = deferredDocument.getNodeExtra(i, false); final List<String> attributes = new ArrayList<>(); map.put(i, attributes); while (attrIndex != -1) { attributes.add(deferredDocument.getNodeName(attrIndex, false)); attrIndex = deferredDocument.getPrevSibling(attrIndex, false); } } } } return map; }
/** * Returns internal Xerces details about all elements in the specified document. * The id of the returned {@link Map} is the {@code nodeIndex} of an element, and the list * is the array of ordered attributes names. * @param document the document * @return the map of an element index with its ordered attribute names */ public static Map<Integer, List<String>> getAttributesOrderMap(final Document document) { final Map<Integer, List<String>> map = new HashMap<>(); if (document instanceof DeferredDocumentImpl) { final DeferredDocumentImpl deferredDocument = (DeferredDocumentImpl) document; final int fNodeCount = getPrivate(deferredDocument, "fNodeCount"); for (int i = 0; i < fNodeCount; i++) { final int type = deferredDocument.getNodeType(i, false); if (type == Node.ELEMENT_NODE) { int attrIndex = deferredDocument.getNodeExtra(i, false); final List<String> attributes = new ArrayList<>(); map.put(i, attributes); while (attrIndex != -1) { attributes.add(deferredDocument.getNodeName(attrIndex, false)); attrIndex = deferredDocument.getPrevSibling(attrIndex, false); } } } } return map; }
nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
/** Synchronizes the data (name and value) for fast nodes. */ protected final void synchronizeData() { // no need to sync in the future needsSyncData(false); // fluff data DeferredDocumentImpl ownerDocument = (DeferredDocumentImpl)this.ownerDocument; // we don't want to generate any event for this so turn them off boolean orig = ownerDocument.mutationEvents; ownerDocument.mutationEvents = false; name = ownerDocument.getNodeName(fNodeIndex); // attributes setupDefaultAttributes(); int index = ownerDocument.getNodeExtra(fNodeIndex); if (index != -1) { NamedNodeMap attrs = getAttributes(); do { NodeImpl attr = (NodeImpl)ownerDocument.getNodeObject(index); attrs.setNamedItem(attr); index = ownerDocument.getPrevSibling(index); } while (index != -1); } // set mutation events flag back to its original value ownerDocument.mutationEvents = orig; } // synchronizeData()
/** Synchronizes the default attribute values. */ protected void synchronizeChildren() { // we don't want to generate any event for this so turn them off boolean orig = ownerDocument.getMutationEvents(); ownerDocument.setMutationEvents(false); // attributes are now synced needsSyncChildren(false); // create attributes node map DeferredDocumentImpl ownerDocument = (DeferredDocumentImpl)this.ownerDocument; attributes = new NamedNodeMapImpl(ownerDocument); // Default attributes dangle as children of the element // definition "node" in the internal fast table. for (int nodeIndex = ownerDocument.getLastChild(fNodeIndex); nodeIndex != -1; nodeIndex = ownerDocument.getPrevSibling(nodeIndex)) { Node attr = ownerDocument.getNodeObject(nodeIndex); attributes.setNamedItem(attr); } // set mutation events flag back to its original value ownerDocument.setMutationEvents(orig); } // synchronizeChildren()
attrs.setNamedItem(attr); attrIndex = ownerDocument.getPrevSibling(attrIndex); } while (attrIndex != -1);
int prev = getPrevSibling(last); if (prev == -1) { a.value = getNodeValueString(nodeIndex); ChildNode lastNode = null; for (int index = last; index != -1; index = getPrevSibling(index)) {
for (int index = getLastChild(nodeIndex); index != -1; index = getPrevSibling(index)) {
for (int index = ownerDocument.getLastChild(fNodeIndex); index != -1; index = ownerDocument.getPrevSibling(index)) {
for (int index = getLastChild(0); index != -1; index = getPrevSibling(index)) {