Java XML Attribute from Node getNodeAttributesToString(Node node)

Here you can find the source of getNodeAttributesToString(Node node)

Description

Returns in a String the attributes and values of the node.

License

Apache License

Parameter

Parameter Description
node The Node

Return

The String of attributes and values.

Declaration

public static String getNodeAttributesToString(Node node) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Node;

public class Main {
    /**//from w  w  w . jav a 2  s .  c om
     * Returns in a String the attributes and values of the node.
     * 
     * @param node
     *            The {@link Node}
     * @return The String of attributes and values.
     */
    public static String getNodeAttributesToString(Node node) {
        String atributos = "";
        String coma = "";
        for (int j = 0; j < node.getAttributes().getLength(); j++) {
            Node atributo = node.getAttributes().item(j);
            atributos = atributos + coma + atributo.toString();
            coma = " ; ";
        }
        return atributos;
    }
}

Related

  1. getNodeAttribute(Node QueryNode, String AttrName)
  2. getNodeAttribute(Node thisNode, String key)
  3. getNodeAttributeAsInt(Node node, String attributeName, int defaultValue)
  4. getNodeAttributeDeep(NodeList nodelList, String nodeName, String nodeAttr)
  5. getNodeAttributes(final Node node)
  6. getNodeAttributeValue(Node element, String attributeName)
  7. getNodeAttributeValue(Node node, String attribute)
  8. getNodeAttributeValue(Node node, String attributeName)
  9. getNodeAttributeValue(Node node, String attributeName)