Java XML Element to String getStringValue(Element from)

Here you can find the source of getStringValue(Element from)

Description

get String Value

License

Open Source License

Declaration

public static String getStringValue(Element from) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class Main {
    public static String getStringValue(Element from) {
        String value = from.getFirstChild().getNodeValue();
        return value;
    }/*from  ww w .j  av a 2 s.  c o  m*/

    public static String getStringValue(Element from, String elementName) {
        String value = null;
        NodeList nodes = from.getElementsByTagName(elementName);
        if (nodes != null && nodes.getLength() > 0) {
            value = nodes.item(0).getChildNodes().item(0).getNodeValue();
        }
        return value;
    }
}

Related

  1. getStringProperty(Element properties, String name)
  2. getStringRepresentation(Element element)
  3. getStringValue(Element el)
  4. getStringValue(Element ele, String tagName)
  5. getStringValue(Element element, String tagName)
  6. getStringValue(final Element element)
  7. getStringValueByTagName(Element element, String tagName)
  8. getStringValueOfElement(Element elem)
  9. getStringValues(Element from, String elementName)