Java XML Element to String getStringValues(Element from, String elementName)

Here you can find the source of getStringValues(Element from, String elementName)

Description

get String Values

License

Open Source License

Declaration

public static List<String> getStringValues(Element from, String elementName) 

Method Source Code


//package com.java2s;

import java.util.LinkedList;
import java.util.List;

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

public class Main {
    public static List<String> getStringValues(Element from, String elementName) {
        List<String> values = new LinkedList<String>();
        NodeList nodes = from.getElementsByTagName(elementName);
        if (nodes != null) {
            for (int i = 0; i < nodes.getLength(); i++) {
                values.add(nodes.item(i).getChildNodes().item(0).getNodeValue());
            }//www  .  j  av a  2s.  c om
        }
        return values;
    }
}

Related

  1. getStringValue(Element element, String tagName)
  2. getStringValue(Element from)
  3. getStringValue(final Element element)
  4. getStringValueByTagName(Element element, String tagName)
  5. getStringValueOfElement(Element elem)
  6. getXmlString(Element node)
  7. getXMLStringFromNode(Element node)
  8. toString(Element e)
  9. toString(Element element)