Android XML Attribute Get getXmlAttribute(Context context, XmlResourceParser xml, String name)

Here you can find the source of getXmlAttribute(Context context, XmlResourceParser xml, String name)

Description

get Xml Attribute

Declaration

private static String getXmlAttribute(Context context,
            XmlResourceParser xml, String name) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.content.res.XmlResourceParser;

public class Main {
    private static String getXmlAttribute(Context context,
            XmlResourceParser xml, String name) {
        int resId = xml.getAttributeResourceValue(null, name, 0);
        if (resId == 0) {
            return xml.getAttributeValue(null, name);
        } else {// w  w w  . j a va  2  s .  c om
            return context.getString(resId);
        }
    }
}

Related

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