Java XML Element to String getStringValue(Element ele, String tagName)

Here you can find the source of getStringValue(Element ele, String tagName)

Description

get String Value

License

Open Source License

Declaration

private static String getStringValue(Element ele, String tagName) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    private static String getStringValue(Element ele, String tagName) {
        String value = null;/*from w  w  w  .j  a v  a  2s .c  o m*/

        NodeList nl = ele.getElementsByTagName(tagName);
        if (nl != null && nl.getLength() > 0) {
            Element el = (Element) nl.item(0);
            value = el.getFirstChild().getNodeValue();
        }

        return value;
    }
}

Related

  1. getStringFromParagraphElement(Element element)
  2. getStringOptionsList(final Element configuration, final String optionPrefix, final String option)
  3. getStringProperty(Element properties, String name)
  4. getStringRepresentation(Element element)
  5. getStringValue(Element el)
  6. getStringValue(Element element, String tagName)
  7. getStringValue(Element from)
  8. getStringValue(final Element element)
  9. getStringValueByTagName(Element element, String tagName)