Java XML Element to String getString(Element el, String label)

Here you can find the source of getString(Element el, String label)

Description

get String

License

Open Source License

Declaration

public static String getString(Element el, String label) 

Method Source Code


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

import org.w3c.dom.*;

public class Main {
    public static String getString(Element el, String label) {
        NodeList l = el.getElementsByTagName(label);
        if (l.getLength() < 1)
            return null;
        Node n = l.item(0).getFirstChild();
        return n == null ? "" : n.getNodeValue();
    }//  w ww.  j  a va  2  s . co  m
}

Related

  1. extractText(Element obj, String localName)
  2. extractTextElementValue(final Element textElement)
  3. getElementAsInputStream(Element xml)
  4. getElementText(Element e)
  5. getNamedElemXml(Element parent, String elementName)
  6. getString(Element element)
  7. getString(Element element, String expr)
  8. getString(Element element, String name, String def)
  9. getString(Element root, String name)