/** * Create a node with the specified name, attributes and values. attVal is a * suite : att1,val1,att2,val2,... * * @param document * xlm document * @param nodeName * node name * @param attVal * attribute values * @return the node with its attribute, null if the array is not correct or * the document is null. */ public static Node createNode(final Document document, final String nodeName, final String... attVal) { Node element = null; if ((document != null) && (attVal.length % 2 == 0)) { element = document.createElement(nodeName); for (int i = 0; i < attVal.length; i = i + 2) { element.getAttributes().setNamedItem( createAttribute(document, attVal[i], attVal[i + 1])); } } return element; }