/** * Adds an AnyNode to the current node * * @param node the node to append */ public void addAnyNode(AnyNode node) { if (node == null) { throw new IllegalArgumentException("null argument in addAnyNode"); } switch (node.getNodeType()) { case ATTRIBUTE: addAttribute(node); break; case NAMESPACE: addNamespace(node); break; default: addChild(node); break; } }
/** * Adds an AnyNode to the current node * @param node the node to append */ public void addAnyNode(AnyNode node) { if (node == null) { throw new IllegalArgumentException("null argument in addAnyNode"); } switch(node.getNodeType()) { case ATTRIBUTE: addAttribute(node); break; case NAMESPACE: addNamespace(node); break; default: addChild(node); break; } }
_node.addAttribute(tempNode);
_node.addAttribute(tempNode);
/** * Adds an attribute to the current node. * @param node the attribute to add. */ public void addAttribute(AnyNode node) { if (node == null) { throw new IllegalArgumentException("null argument in addAttribute"); } if (node.getNodeType() != ATTRIBUTE) { throw new IllegalArgumentException("Only attribute can be added as an attribute"); } if (_firstChildNode == null) { _firstChildNode = node; } else { if (_firstChildNode.getNodeType() == ATTRIBUTE) { //if we reach an attribute then we add the node as its sibling _firstChildNode.appendSibling(node); } else if (_firstChildNode.getNodeType() == NAMESPACE) { //if we reach an namespace the attributre should be added to //the first child of the namespace _firstChildNode.addAttribute(node); } else { //unplug the current firstNode to add a new one node.addChild(_firstChildNode); _firstChildNode = node; } } } //addAttribute
/** * Adds an attribute to the current node. * * @param node the attribute to add. */ public void addAttribute(AnyNode node) { if (node == null) { throw new IllegalArgumentException("null argument in addAttribute"); } if (node.getNodeType() != ATTRIBUTE) { throw new IllegalArgumentException("Only attribute can be added as an attribute"); } if (_firstChildNode == null) { _firstChildNode = node; } else { if (_firstChildNode.getNodeType() == ATTRIBUTE) { // if we reach an attribute then we add the node as its sibling _firstChildNode.appendSibling(node); } else if (_firstChildNode.getNodeType() == NAMESPACE) { // if we reach an namespace the attributre should be added to // the first child of the namespace _firstChildNode.addAttribute(node); } else { // unplug the current firstNode to add a new one node.addChild(_firstChildNode); _firstChildNode = node; } } } // addAttribute
_node.addAttribute(tempNode);
_node.addAttribute(tempNode);
} else prefix = null; node.addAttribute( new AnyNode(AnyNode.ATTRIBUTE, atts.getName(i), prefix, namespace, atts.getValue(i)));
prefix = null; node.addAttribute( new AnyNode(AnyNode.ATTRIBUTE, atts.getName(i), prefix, namespace, atts.getValue(i)));
node.addAttribute( new AnyNode(AnyNode.ATTRIBUTE, atts.getName(i), prefix, namespace,
node.addAttribute( new AnyNode(AnyNode.ATTRIBUTE, atts.getName(i), prefix, namespace,