Android XML Attribute Get getNodeAttributeOrDefault(Node node, String name, String defaultValue)

Here you can find the source of getNodeAttributeOrDefault(Node node, String name, String defaultValue)

Description

get Node Attribute Or Default

License

Open Source License

Declaration

public static String getNodeAttributeOrDefault(Node node, String name,
            String defaultValue) 

Method Source Code

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

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    public static String getNodeAttributeOrDefault(Node node, String name,
            String defaultValue) {
        NamedNodeMap attributes = node.getAttributes();
        Node valueNode = attributes.getNamedItem(name);
        String value = defaultValue;
        if (valueNode != null)
            value = valueNode.getNodeValue();
        return value;
    }/*from   w w  w.  j  av  a  2  s.c o m*/
}

Related

  1. extractAttributesFromTag(String tag)
  2. getAttribute(String key, Attributes attributes, Map tagCache)
  3. getAttributesValue(Attributes attrs, String name)
  4. getXmlAttribute(Context context, XmlResourceParser xml, String name)
  5. getNodeAttributeOrFail( Node node, String name, ExceptionType e)
  6. getNodeAttributeOrFail( Node node, String name, T e)