Java XML Node Text Value getStringValue(NamedNodeMap values, String name)

Here you can find the source of getStringValue(NamedNodeMap values, String name)

Description

get String Value

License

Open Source License

Declaration

public static String getStringValue(NamedNodeMap values, String name) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2004-2010 Sunil Kamath (IcemanK). All rights reserved. This
 * program is made available under the terms of the Common Public License v1.0
 * which is available at http://www.eclipse.org/legal/cpl-v10.html
 * /*from w w  w .j  a va  2s.  c o m*/
 * Contributors: Sunil Kamath (IcemanK) - initial API and implementation
 *******************************************************************************/

import org.w3c.dom.*;

public class Main {
    public static String getStringValue(NamedNodeMap values, String name) {
        return getStringValue(values, name, null);
    }

    public static String getStringValue(NamedNodeMap values, String name, String defaultValue) {
        Node node = values.getNamedItem(name);
        return node == null ? defaultValue : node.getNodeValue();
    }
}

Related

  1. getSimpleNodeValue(Node node)
  2. getSingleNodeTextContent(Node node, String path)
  3. getStrElementValue(Node node)
  4. getString(final Node node, final String default_value)
  5. getString(Node node)
  6. getStringValue(Node node)
  7. getStringValue(Node node)
  8. getTagValue(Node node, String name)
  9. getTagValueWithoutNamespace(Node n)