Package org.robolectric.android
Class XmlResourceParserImpl
java.lang.Object
org.robolectric.android.XmlResourceParserImpl
- All Implemented Interfaces:
XmlResourceParser
,AttributeSet
,AutoCloseable
,XmlPullParser
public class XmlResourceParserImpl extends Object implements XmlResourceParser
Concrete implementation of the
XmlResourceParser
.
Clients expects a pull parser while the resource loader
initialise this object with a Document
.
This implementation navigates the dom and emulates a pull
parser by raising all the opportune events.
Note that the original android implementation is based on
a set of native methods calls. Here those methods are
re-implemented in java when possible.-
Field Summary
Fields Modifier and Type Field Description static String[]
AVAILABLE_FEATURES
All the parser features currently supported by Android.static String[]
UNAVAILABLE_FEATURES
All the parser features currently NOT supported by Android.Fields inherited from interface org.xmlpull.v1.XmlPullParser
CDSECT, COMMENT, DOCDECL, END_DOCUMENT, END_TAG, ENTITY_REF, FEATURE_PROCESS_DOCDECL, FEATURE_PROCESS_NAMESPACES, FEATURE_REPORT_NAMESPACE_ATTRIBUTES, FEATURE_VALIDATION, IGNORABLE_WHITESPACE, NO_NAMESPACE, PROCESSING_INSTRUCTION, START_DOCUMENT, START_TAG, TEXT, TYPES
-
Constructor Summary
Constructors Constructor Description XmlResourceParserImpl(Document document, String fileName, String packageName, String applicationPackageName, ResourceTable resourceTable)
Deprecated.XmlResourceParserImpl(Document document, Path fileName, String packageName, String applicationPackageName, ResourceTable resourceTable)
-
Method Summary
-
Field Details
-
AVAILABLE_FEATURES
All the parser features currently supported by Android. -
UNAVAILABLE_FEATURES
All the parser features currently NOT supported by Android.
-
-
Constructor Details
-
XmlResourceParserImpl
@Deprecated public XmlResourceParserImpl(Document document, String fileName, String packageName, String applicationPackageName, ResourceTable resourceTable)Deprecated. -
XmlResourceParserImpl
public XmlResourceParserImpl(Document document, Path fileName, String packageName, String applicationPackageName, ResourceTable resourceTable)
-
-
Method Details
-
setFeature
- Specified by:
setFeature
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getFeature
- Specified by:
getFeature
in interfaceXmlPullParser
-
setProperty
- Specified by:
setProperty
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getProperty
- Specified by:
getProperty
in interfaceXmlPullParser
-
setInput
- Specified by:
setInput
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
setInput
- Specified by:
setInput
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
defineEntityReplacementText
public void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException- Specified by:
defineEntityReplacementText
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getNamespacePrefix
- Specified by:
getNamespacePrefix
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getInputEncoding
- Specified by:
getInputEncoding
in interfaceXmlPullParser
-
getNamespace
- Specified by:
getNamespace
in interfaceXmlPullParser
-
getNamespaceCount
- Specified by:
getNamespaceCount
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getPositionDescription
- Specified by:
getPositionDescription
in interfaceAttributeSet
- Specified by:
getPositionDescription
in interfaceXmlPullParser
-
getNamespaceUri
- Specified by:
getNamespaceUri
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getColumnNumber
public int getColumnNumber()- Specified by:
getColumnNumber
in interfaceXmlPullParser
-
getDepth
public int getDepth()- Specified by:
getDepth
in interfaceXmlPullParser
-
getText
- Specified by:
getText
in interfaceXmlPullParser
-
getLineNumber
public int getLineNumber()- Specified by:
getLineNumber
in interfaceXmlPullParser
-
getEventType
- Specified by:
getEventType
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
isWhitespace
- Throws:
XmlPullParserException
-
isWhitespace
- Specified by:
isWhitespace
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getPrefix
- Specified by:
getPrefix
in interfaceXmlPullParser
-
getTextCharacters
public char[] getTextCharacters(int[] holderForStartAndLength)- Specified by:
getTextCharacters
in interfaceXmlPullParser
-
getNamespace
- Specified by:
getNamespace
in interfaceXmlPullParser
-
getName
- Specified by:
getName
in interfaceXmlPullParser
-
getAttribute
-
getAttributeNamespace
- Specified by:
getAttributeNamespace
in interfaceAttributeSet
- Specified by:
getAttributeNamespace
in interfaceXmlPullParser
- Specified by:
getAttributeNamespace
in interfaceXmlResourceParser
-
getAttributeName
- Specified by:
getAttributeName
in interfaceAttributeSet
- Specified by:
getAttributeName
in interfaceXmlPullParser
-
getAttributePrefix
- Specified by:
getAttributePrefix
in interfaceXmlPullParser
-
isEmptyElementTag
- Specified by:
isEmptyElementTag
in interfaceXmlPullParser
- Throws:
XmlPullParserException
-
getAttributeCount
public int getAttributeCount()- Specified by:
getAttributeCount
in interfaceAttributeSet
- Specified by:
getAttributeCount
in interfaceXmlPullParser
-
getAttributeValue
- Specified by:
getAttributeValue
in interfaceAttributeSet
- Specified by:
getAttributeValue
in interfaceXmlPullParser
-
qualify
-
getAttributeType
- Specified by:
getAttributeType
in interfaceXmlPullParser
-
isAttributeDefault
public boolean isAttributeDefault(int index)- Specified by:
isAttributeDefault
in interfaceXmlPullParser
-
nextToken
- Specified by:
nextToken
in interfaceXmlPullParser
- Throws:
XmlPullParserException
IOException
-
getAttributeValue
- Specified by:
getAttributeValue
in interfaceAttributeSet
- Specified by:
getAttributeValue
in interfaceXmlPullParser
-
next
- Specified by:
next
in interfaceXmlPullParser
- Throws:
XmlPullParserException
IOException
-
require
public void require(int type, String namespace, String name) throws XmlPullParserException, IOException- Specified by:
require
in interfaceXmlPullParser
- Throws:
XmlPullParserException
IOException
-
nextText
- Specified by:
nextText
in interfaceXmlPullParser
- Throws:
XmlPullParserException
IOException
-
nextTag
- Specified by:
nextTag
in interfaceXmlPullParser
- Throws:
XmlPullParserException
IOException
-
getAttributeNameResource
public int getAttributeNameResource(int index)- Specified by:
getAttributeNameResource
in interfaceAttributeSet
-
getAttributeListValue
public int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue)- Specified by:
getAttributeListValue
in interfaceAttributeSet
-
getAttributeBooleanValue
- Specified by:
getAttributeBooleanValue
in interfaceAttributeSet
-
getAttributeResourceValue
- Specified by:
getAttributeResourceValue
in interfaceAttributeSet
-
getAttributeIntValue
- Specified by:
getAttributeIntValue
in interfaceAttributeSet
-
getAttributeUnsignedIntValue
- Specified by:
getAttributeUnsignedIntValue
in interfaceAttributeSet
-
getAttributeFloatValue
- Specified by:
getAttributeFloatValue
in interfaceAttributeSet
-
getAttributeListValue
- Specified by:
getAttributeListValue
in interfaceAttributeSet
-
getAttributeBooleanValue
public boolean getAttributeBooleanValue(int idx, boolean defaultValue)- Specified by:
getAttributeBooleanValue
in interfaceAttributeSet
-
getAttributeResourceValue
public int getAttributeResourceValue(int idx, int defaultValue)- Specified by:
getAttributeResourceValue
in interfaceAttributeSet
-
getAttributeIntValue
public int getAttributeIntValue(int idx, int defaultValue)- Specified by:
getAttributeIntValue
in interfaceAttributeSet
-
getAttributeUnsignedIntValue
public int getAttributeUnsignedIntValue(int idx, int defaultValue)- Specified by:
getAttributeUnsignedIntValue
in interfaceAttributeSet
-
getAttributeFloatValue
public float getAttributeFloatValue(int idx, float defaultValue)- Specified by:
getAttributeFloatValue
in interfaceAttributeSet
-
getIdAttribute
- Specified by:
getIdAttribute
in interfaceAttributeSet
-
getClassAttribute
- Specified by:
getClassAttribute
in interfaceAttributeSet
-
getIdAttributeResourceValue
public int getIdAttributeResourceValue(int defaultValue)- Specified by:
getIdAttributeResourceValue
in interfaceAttributeSet
-
getStyleAttribute
public int getStyleAttribute()- Specified by:
getStyleAttribute
in interfaceAttributeSet
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceXmlResourceParser
-
finalize
-