Android XML Attribute Get getNodeAttributeOrFail( Node node, String name, ExceptionType e)

Here you can find the source of getNodeAttributeOrFail( Node node, String name, ExceptionType e)

Description

get Node Attribute Or Fail

License

Open Source License

Declaration

public static <ExceptionType extends Exception> String getNodeAttributeOrFail(
            Node node, String name, ExceptionType e) throws ExceptionType 

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 <ExceptionType extends Exception> String getNodeAttributeOrFail(
            Node node, String name, ExceptionType e) throws ExceptionType {
        NamedNodeMap attributes = node.getAttributes();
        Node valueNode = attributes.getNamedItem(name);
        if (valueNode == null)
            throw e;
        return valueNode.getNodeValue();
    }/*  w  w  w .j  a v a2  s.co 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. getNodeAttributeOrDefault(Node node, String name, String defaultValue)
  6. getNodeAttributeOrFail( Node node, String name, T e)