private UserData getUserData(Document doc) { NodeImpl impl = (NodeImpl)doc; UserData data = (UserData)impl.getUserData(); if(data==null) { data = new UserData(); impl.setUserData(data); } return data; }
/** * Override parent's method to set the ownerNode correctly */ protected void cloneContent(NamedNodeMapImpl srcmap) { List srcnodes = srcmap.nodes; if (srcnodes != null) { int size = srcnodes.size(); if (size != 0) { if (nodes == null) { nodes = new ArrayList(size); } else { nodes.clear(); } for (int i = 0; i < size; ++i) { NodeImpl n = (NodeImpl) srcnodes.get(i); NodeImpl clone = (NodeImpl) n.cloneNode(true); clone.isSpecified(n.isSpecified()); nodes.add(clone); clone.ownerNode = ownerNode; clone.isOwned(true); } } } } // cloneContent():AttributeMap
protected void cloneContent(NamedNodeMapImpl srcmap) { List srcnodes = srcmap.nodes; if (srcnodes != null) { int size = srcnodes.size(); if (size != 0) { if (nodes == null) { nodes = new ArrayList(size); } else { nodes.clear(); } for (int i = 0; i < size; ++i) { NodeImpl n = (NodeImpl) srcmap.nodes.get(i); NodeImpl clone = (NodeImpl) n.cloneNode(true); clone.isSpecified(n.isSpecified()); nodes.add(clone); } } } } // cloneMap():NamedNodeMapImpl
switch (node.getNodeType()) { case ATTRIBUTE_NODE: { AttrImpl attr = (AttrImpl) node; userData = node.getUserDataRecord(); userData = node.getUserDataRecord(); Node parent = node.getParentNode(); if (parent != null) { parent.removeChild(source); while ((child = node.getFirstChild()) != null) { node.removeChild(child); node.setOwnerDocument(this); if(userData != null) setUserDataTable(node,userData); Node entityNode = entities.getNamedItem(node.getNodeName()); if (entityNode == null) { break; child != null; child = child.getNextSibling()) { Node childClone = child.cloneNode(true); node.appendChild(childClone); userData = node.getUserDataRecord();
short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE: { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); if (this.hasAttributes()) { ElementImpl elem = (ElementImpl)this; NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns"); if (attr != null) { String value = attr.getNodeValue(); if (namespaceURI == null) { return (namespace == value); NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI); if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) { return ownerNode.isDefaultNamespace(namespaceURI); NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.isDefaultNamespace(namespaceURI);
short type = this.getNodeType(); switch (type) { case Node.ELEMENT_NODE : { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); if (namespace !=null) { if (this.hasAttributes()) { NamedNodeMap map = this.getAttributes(); int length = map.getLength(); for (int i=0;i<length;i++) { NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.lookupNamespaceURI(specifiedPrefix); if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) { return ownerNode.lookupNamespaceURI(specifiedPrefix); NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.lookupNamespaceURI(specifiedPrefix);
String lookupNamespacePrefix(String namespaceURI, ElementImpl el){ String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); if (this.hasAttributes()) { NamedNodeMap map = this.getAttributes(); int length = map.getLength(); for (int i=0;i<length;i++) { NodeImpl ancestor = (NodeImpl)getElementAncestor(this); return ancestor.lookupNamespacePrefix(namespaceURI, el);
short type = this.getNodeType(); this.getNamespaceURI(); // to flip out children return lookupNamespacePrefix(namespaceURI, (ElementImpl)this); if (this.ownerNode.getNodeType() == Node.ELEMENT_NODE) { return ownerNode.lookupPrefix(namespaceURI); NodeImpl ancestor = (NodeImpl)getElementAncestor(this); if (ancestor != null) { return ancestor.lookupPrefix(namespaceURI);
/** * NON-DOM INTERNAL: DOMNodeInsertedIntoDocument and ...RemovedFrom... * are dispatched to an entire subtree. This is the distribution code * therefor. They DO NOT bubble, thanks be, but may be captured. * <p> * Similar to code in dispatchingEventToSubtree however this method * is only used on the target node and does not start a dispatching chain * on the sibling of the target node as this is not part of the subtree * ***** At the moment I'm being sloppy and using the normal * capture dispatcher on every node. This could be optimized hugely * by writing a capture engine that tracks our position in the tree to * update the capture chain without repeated chases up to root. * @param n target node (that was directly inserted or removed) * @param e event to be sent to that node and its subtree */ protected void dispatchEventToSubtree(Node n, Event e) { ((NodeImpl) n).dispatchEvent(e); if (n.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap a = n.getAttributes(); for (int i = a.getLength() - 1; i >= 0; --i) dispatchingEventToSubtree(a.item(i), e); } dispatchingEventToSubtree(n.getFirstChild(), e); } // dispatchEventToSubtree(NodeImpl,Node,Event) :void
formProperty.setOfficeCurrencyAttribute(officeCurrency); ((NodeImpl) parentEle).appendChild(formProperty);
/** * Returns the absolute base URI of this node or null if the implementation * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a * null is returned. * * @return The absolute base URI of this node or null. * @since DOM Level 3 */ public String getBaseURI() { if (needsSyncData()) { synchronizeData(); } return ownerNode.getBaseURI(); }
ChildNode newnode = (ChildNode) super.cloneNode(deep);
/** * Add WSDL element to element list. */ private void addElementToList(Element element, Object wsdlElement) { ElementLocation elementLocation = null; try { // See if the element object is an instanceof org.apache.xerces.dom.ElementImpl ElementImpl elementImpl = (ElementImpl) element; // If it is, then get the element location information elementLocation = (ElementLocation) elementImpl.getUserData(); // Add it to the list this.wsdlElementList.addElement(wsdlElement, elementLocation); } catch (ClassCastException cce) { // ADD: Should we add the element with a null or zero location? } }
elementImpl.setUserData(new ElementLocation(locator.getLineNumber(), locator.getColumnNumber()));
/** * Dispatches event to the target node's descendents recursively * * @param n node to dispatch to * @param e event to be sent to that node and its subtree */ protected void dispatchingEventToSubtree(Node n, Event e) { if (n==null) return; // ***** Recursive implementation. This is excessively expensive, // and should be replaced in conjunction with optimization // mentioned above. ((NodeImpl) n).dispatchEvent(e); if (n.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap a = n.getAttributes(); for (int i = a.getLength() - 1; i >= 0; --i) dispatchingEventToSubtree(a.item(i), e); } dispatchingEventToSubtree(n.getFirstChild(), e); dispatchingEventToSubtree(n.getNextSibling(), e); }
formProperty.setOfficeCurrencyAttribute(officeCurrency); ((NodeImpl) parentEle).appendChild(formProperty);
String parentBaseURI = (this.ownerNode != null) ? this.ownerNode.getBaseURI() : null; if (parentBaseURI != null) { try { return (this.ownerNode != null) ? this.ownerNode.getBaseURI() : null;
public Node cloneNode(boolean deep) { if (needsSyncChildren()) { synchronizeChildren(); } AttrImpl clone = (AttrImpl) super.cloneNode(deep); // take care of case where there are kids if (!clone.hasStringValue()) { // Need to break the association w/ original kids clone.value = null; // Cloning an Attribute always clones its children, // since they represent its value, no matter whether this // is a deep clone or not for (Node child = (Node) value; child != null; child = child.getNextSibling()) { clone.appendChild(child.cloneNode(true)); } } clone.isSpecified(true); return clone; }
/** * Add the refObject to the elementLocation hashtable with the location defined in element. * * @param refObject The object to add. * @param element The element that contains the location information. */ protected void setLocation(Object refObject, Element element) { try { ElementImpl elementImpl = (ElementImpl)element; ElementLocation elementLocation = (ElementLocation)elementImpl.getUserData(); if (elementLocation != null) { elementLocations.put( refObject, new LocationHolder(elementLocation.getLineNumber(), elementLocation.getColumnNumber(), def.getDocumentBaseURI())); } } catch (ClassCastException e) { } } /**