Class XmlResourceHelper
java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.XmlResourceHelper
- Direct Known Subclasses:
ApkXmlResourceHelper
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.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a manifest helper around the provided manifest unit.Create a manifest helper around the provided low-level XML document object. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildAttributeName
(String name) convertEltlist
(NodeList nodelist) convertNodelist
(NodeList nodelist) protected String
This low-level method offers access to theorg.w3c.dom.Element
holding the root.protected String
getSimpleName
(String name) boolean
hasAttributeValue
(String tagName, String attrName, String wantedAttrValue) protected boolean
isFullyQualifiedName
(String name) protected boolean
isSimpleName
(String name) protected void
readAttribute
(String tagName, String attrName) Retrieve the attribute value of the first tag having the provided name.readAttributes
(String tagName, String attrName) Retrieve the attribute values for all tags having the provided name.readMultiAttributes
(String tagName, String... attrNames) Retrieve several attribute values for all tags having the provided name.
-
Field Details
-
doc
-
rootElt
-
-
Constructor Details
-
XmlResourceHelper
Create a manifest helper around the provided manifest unit.- Parameters:
xml
-
-
XmlResourceHelper
Create a manifest helper around the provided low-level XML document object.- Parameters:
doc
-
-
-
Method Details
-
prepare
-
getRootElement
This low-level method offers access to theorg.w3c.dom.Element
holding the root.- Returns:
-
buildAttributeName
-
convertNodelist
-
convertEltlist
-
readAttribute
Retrieve the attribute value of the first tag having the provided name.- Parameters:
tagName
-attrName
-- Returns:
- 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)
-
readAttributes
Retrieve the attribute values for all tags having the provided name.- Parameters:
tagName
-attrName
-- Returns:
- a list of non-null strings
-
hasAttributeValue
-
readMultiAttributes
Retrieve several attribute values for all tags having the provided name.- Parameters:
tagName
-attrNames
- a collection of attributes to be retrieved- Returns:
-
getAttr
-
isFullyQualifiedName
-
isSimpleName
-
getSimpleName
-