/** * Parses this node and builds the object structure in memory. AXIOM supports two levels of * deffered building. First is deffered building of AXIOM using StAX. Second level is the deffered * building of attachments. AXIOM reads in the attachements from the stream only when user asks by * calling getDataHandler(). build() method builds the OM without the attachments. buildAll() * builds the OM together with attachement data. This becomes handy when user wants to free the * input stream. */ public void buildWithAttachments() { if (!this.done) { this.build(); } }
final boolean equal = true; final boolean notEqual = false; if (this.getNodeType() != node.getNodeType()) { return notEqual; if (checkStringAttributeEquality(node)) { if (checkNamedNodeMapEquality(node)) {
/** BORROWED from Xerces impl. */ protected void cloneContent(NamedNodeMapImpl srcmap) { Vector srcnodes = srcmap.nodes; if (srcnodes != null) { int size = srcnodes.size(); if (size != 0) { if (nodes == null) { nodes = new Vector(size); } nodes.setSize(size); for (int i = 0; i < size; ++i) { NodeImpl n = (NodeImpl) srcnodes.elementAt(i); NodeImpl clone = (NodeImpl) n.cloneNode(true); clone.isSpecified(n.isSpecified()); nodes.setElementAt(clone, i); clone.ownerNode = this.ownerNode.ownerNode; clone.isOwned(true); } } } } // cloneContent():AttributeMap
if (node.getNodeName() == null ^ this.getNodeName() == null) { return notEqual; } else { if (!(node.getNodeName().equals(this.getNodeName()))) { return notEqual; if (node.getLocalName() == null ^ this.getLocalName() == null) { return notEqual; } else { if (!(node.getLocalName().equals(this.getLocalName()))) { return notEqual; if (node.getNamespaceURI() == null ^ this.getNamespaceURI() == null) { return notEqual; } else { if (!(node.getNamespaceURI().equals(this.getNamespaceURI()))) { return notEqual; if (node.getPrefix() == null ^ this.getPrefix() == null) { return notEqual; } else { if (!(node.getPrefix().equals(this.getPrefix()))) { return notEqual; if (node.getNodeValue() == null ^ this.getNodeValue() == null) {
/** This findNamePoint is for DOM Level 2 Namespaces. */ protected int findNamePoint(String namespaceURI, String name) { if (nodes == null) return -1; if (name == null) return -1; // This is a linear search through the same nodes Vector. // The Vector is sorted on the DOM Level 1 nodename. // The DOM Level 2 NS keys are namespaceURI and Localname, // so we must linear search thru it. // In addition, to get this to work with nodes without any namespace // (namespaceURI and localNames are both null) we then use the nodeName // as a seconday key. for (int i = 0; i < nodes.size(); i++) { NodeImpl a = (NodeImpl) nodes.elementAt(i); String aNamespaceURI = a.getNamespaceURI(); String aLocalName = a.getLocalName(); if (namespaceURI == null) { if (aNamespaceURI == null && (name.equals(aLocalName) || (aLocalName == null && name.equals(a.getNodeName())))) return i; } else { if (namespaceURI.equals(aNamespaceURI) && name.equals(aLocalName)) return i; } } return -1; }
private boolean checkNamedNodeMapEquality(Node node) { final boolean equal = true; final boolean notEqual = false; if (node.getAttributes() == null ^ this.getAttributes() == null) { return notEqual; NamedNodeMap thisNamedNodeMap = this.getAttributes(); NamedNodeMap nodeNamedNodeMap = node.getAttributes(); NodeImpl thisNode = (NodeImpl) thisNamedNodeMap.item(a); NodeImpl tmpNode = (NodeImpl) nodeNamedNodeMap.getNamedItem(thisNode.getNodeName()); if (tmpNode == null) { } else { NodeImpl node1 = thisNode; if (!(node1.isEqualNode(tmpNode))) { return notEqual;
public Node cloneNode(boolean deep) { ChildNode newnode = (ChildNode) super.cloneNode(deep); // Need to break the association w/ original kids newnode.previousSibling = null; newnode.nextSibling = null; newnode.isFirstChild(false); newnode.parentNode = null; return newnode; }
public Node cloneNode(boolean deep) { AttrImpl clone = (AttrImpl) super.cloneNode(deep); if (clone.attrValue == null) { // Need to break the association w/ original kids clone.attrValue = new TextImpl(this.attrValue.toString(), factory); if (this.attrValue.nextSibling != null) { throw new UnsupportedOperationException( "Attribute value can contain only a text " + "node with out any siblings"); } } clone.isSpecified(true); return clone; }
public void close(boolean build) { if (build) { this.build(); } this.done = true; // If this is a StAXBuilder, close it. if (builder instanceof StAXBuilder && !((StAXBuilder) builder).isClosed()) { ((StAXBuilder) builder).releaseParserOnClose(true); ((StAXBuilder) builder).close(); } }