# Class: com.pnfsoftware.jeb.core.units.code.android.XmlResourceHelper

This helper class facilitates access to the data contained in an XML resource. In particular, the `readAttributeXxx` methods allow easy retrieval of attribute values by tag names, throughout the entire document.

## Constructor: XmlResourceHelper
- parameter: `xml`, type: `com.pnfsoftware.jeb.core.units.IXmlUnit`

Description: Create a helper around the provided XML unit.
parameter: xml: XML unit

## Constructor: XmlResourceHelper
- parameter: `doc`, type: `org.w3c.dom.Document`

Description: Create a helper around the provided low\-level XML document object.
parameter: doc: XML document

## Protected Field: doc
Type: `org.w3c.dom.Document`
Description: Source XML document.

## Protected Field: rootElt
Type: `org.w3c.dom.Element`
Description: Root element of the source document.

## Protected Method: buildAttributeName
- parameter: `name`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Build an attribute name usable for lookups.
parameter: name: attribute name
return: the lookup name

## Protected Method: convertEltlist
- parameter: `nodelist`, type: `org.w3c.dom.NodeList`
- return type: `java.util.List<org.w3c.dom.Element>`

Description: Convert a DOM node list to a Java list of elements.
parameter: nodelist: DOM node list of elements
return: the converted list

## Protected Method: convertNodelist
- parameter: `nodelist`, type: `org.w3c.dom.NodeList`
- return type: `java.util.List<org.w3c.dom.Node>`

Description: Convert a DOM node list to a Java list.
parameter: nodelist: DOM node list
return: the converted list

## Protected Method: getAttr
- parameter: `elt`, type: `org.w3c.dom.Element`
- parameter: `name`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve an attribute value from an element.
parameter: elt: element
parameter: name: attribute name
return: the attribute value, or an empty string

## Method: getRootElement
- return type: `org.w3c.dom.Element`

Description: This low\-level method offers access to the `org.w3c.dom.Element` holding the root.
return: the document root element

## Protected Method: getSimpleName
- parameter: `name`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Remove a namespace prefix from a name.
parameter: name: attribute or element name
return: the simple name

## Method: hasAttributeValue
- parameter: `tagName`, type: `java.lang.String`
- parameter: `attrName`, type: `java.lang.String`
- parameter: `wantedAttrValue`, type: `java.lang.String`
- return type: `boolean`

Description: Determine if a tag has a specific attribute value.
parameter: tagName: tag name, or null for the root manifest element
parameter: attrName: attribute name
parameter: wantedAttrValue: expected attribute value
return: true if the value is present

## Protected Method: isFullyQualifiedName
- parameter: `name`, type: `java.lang.String`
- return type: `boolean`

Description: Determine if an attribute name includes a namespace prefix.
parameter: name: attribute name
return: true if the name contains a prefix separator

## Protected Method: isSimpleName
- parameter: `name`, type: `java.lang.String`
- return type: `boolean`

Description: Determine if an attribute name has no namespace prefix.
parameter: name: attribute name
return: true if the name is simple

## Protected Method: prepare
- parameter: `doc`, type: `org.w3c.dom.Document`

Description: The default implementation retrieves sets the [#doc](#doc) and [#rootElt](#rootElt) attributes. Overrides must call this implementation first.
parameter: doc: XML document

## Method: readAttribute
- parameter: `tagName`, type: `java.lang.String`
- parameter: `attrName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve the attribute value of the first tag having the provided name.
parameter: tagName: tag name, or null for the root manifest element
parameter: attrName: attribute name
return: the value \(possibly empty if the attribute is not found in the tag\), or null \(if no         element with the provided tag name was found in the document\)

## Method: readAttributes
- parameter: `tagName`, type: `java.lang.String`
- parameter: `attrName`, type: `java.lang.String`
- return type: `java.util.List<java.lang.String>`

Description: Retrieve the attribute values for all tags having the provided name.
parameter: tagName: tag name, or null for the root manifest element
parameter: attrName: attribute name
return: a list of non\-null strings

## Method: readMultiAttributes
- parameter: `tagName`, type: `java.lang.String`
- parameter: `attrNames`, type: `java.lang.String[]`
- return type: `java.util.List<java.util.List<java.lang.String>>`

Description: Retrieve several attribute values for all tags having the provided name.
parameter: tagName: tag name, or null for the root manifest element
parameter: attrNames: a collection of attributes to be retrieved
return: rows of attribute values, one row per matching element

