Example usage for org.w3c.dom Node getNodeValue

List of usage examples for org.w3c.dom Node getNodeValue

Introduction

In this page you can find the example usage for org.w3c.dom Node getNodeValue.

Prototype

public String getNodeValue() throws DOMException;

Source Link

Document

The value of this node, depending on its type; see the table above.

Usage

From source file:Main.java

public static boolean getBooleanValue(Node node) {
    String value = node.getNodeValue();
    return parseBoolean(value);
}

From source file:Main.java

/**
 * Gets variable of the specified node./*from  w w w  .ja  v a 2  s  . co  m*/
 * 
 * @param node the specified node.
 * @return variable of the specified node.
 */
public static String getNodeValue(Node node) {
    return node.getNodeValue();
}

From source file:Main.java

/**
 * Convenience method to retrieve value of a node.
 * @return node value or {@code null}/*from   ww  w. j  a v  a 2 s . com*/
 */
public static String determineNodeValue(Node node) {
    return node != null ? node.getNodeValue() : null;
}

From source file:Main.java

public static String getTagValue(String sTag, Element eElement) {
    NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes();
    Node nValue = (Node) nlList.item(0);
    return nValue.getNodeValue();
}

From source file:Main.java

public static boolean hasAttribute(Element element, String value) {
    NamedNodeMap attributes = element.getAttributes();
    for (int i = 0; i < attributes.getLength(); i++) {
        Node node = attributes.item(i);
        if (value.equals(node.getNodeValue())) {
            return true;
        }/* w ww.  ja v  a2 s  .c o  m*/
    }
    return false;
}

From source file:Main.java

public static String getTagValue(String sTag, Element eElement) {
    if (eElement.getElementsByTagName(sTag) == null)
        return "";
    if (eElement.getElementsByTagName(sTag).getLength() == 0)
        return "";
    NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes();
    if (nlList == null || nlList.getLength() == 0)
        return "";
    Node nValue = (Node) nlList.item(0);
    return nValue.getNodeValue();
}

From source file:Main.java

public static String getAttributeValue(Node n, String name) {
    Node a = getAttribute(n, name);
    return a == null ? null : a.getNodeValue();
}

From source file:Main.java

public static String getAttributeValue(Node node, String attName) {
    Node attr = node.getAttributes().getNamedItem(attName);
    return attr.getNodeValue();
}

From source file:Main.java

public static String getTagValue(String sTag, Element eElement) {
    String ret = null;/*from   w  ww . j a v  a  2 s.  c  o m*/

    try {
        NodeList nlList = eElement.getElementsByTagName(sTag).item(0).getChildNodes();
        Node nValue = (Node) nlList.item(0);
        ret = nValue.getNodeValue();
    } catch (NullPointerException e) {
        // System.t.println("Null pour l'item : " + sTag);
    }
    return ret;
}

From source file:Main.java

public static String getChildTagValue(Node node, String tag) {
    Element element = (Element) node;
    NodeList childrenWithTag = element.getElementsByTagName(tag).item(0).getChildNodes();

    Node valueNode = (Node) childrenWithTag.item(0);

    return valueNode.getNodeValue();
}