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_FEATURESAll the parser features currently supported by Android.static String[]UNAVAILABLE_FEATURESAll 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:
setFeaturein interfaceXmlPullParser- Throws:
XmlPullParserException
-
getFeature
- Specified by:
getFeaturein interfaceXmlPullParser
-
setProperty
- Specified by:
setPropertyin interfaceXmlPullParser- Throws:
XmlPullParserException
-
getProperty
- Specified by:
getPropertyin interfaceXmlPullParser
-
setInput
- Specified by:
setInputin interfaceXmlPullParser- Throws:
XmlPullParserException
-
setInput
- Specified by:
setInputin interfaceXmlPullParser- Throws:
XmlPullParserException
-
defineEntityReplacementText
public void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException- Specified by:
defineEntityReplacementTextin interfaceXmlPullParser- Throws:
XmlPullParserException
-
getNamespacePrefix
- Specified by:
getNamespacePrefixin interfaceXmlPullParser- Throws:
XmlPullParserException
-
getInputEncoding
- Specified by:
getInputEncodingin interfaceXmlPullParser
-
getNamespace
- Specified by:
getNamespacein interfaceXmlPullParser
-
getNamespaceCount
- Specified by:
getNamespaceCountin interfaceXmlPullParser- Throws:
XmlPullParserException
-
getPositionDescription
- Specified by:
getPositionDescriptionin interfaceAttributeSet- Specified by:
getPositionDescriptionin interfaceXmlPullParser
-
getNamespaceUri
- Specified by:
getNamespaceUriin interfaceXmlPullParser- Throws:
XmlPullParserException
-
getColumnNumber
public int getColumnNumber()- Specified by:
getColumnNumberin interfaceXmlPullParser
-
getDepth
public int getDepth()- Specified by:
getDepthin interfaceXmlPullParser
-
getText
- Specified by:
getTextin interfaceXmlPullParser
-
getLineNumber
public int getLineNumber()- Specified by:
getLineNumberin interfaceXmlPullParser
-
getEventType
- Specified by:
getEventTypein interfaceXmlPullParser- Throws:
XmlPullParserException
-
isWhitespace
- Throws:
XmlPullParserException
-
isWhitespace
- Specified by:
isWhitespacein interfaceXmlPullParser- Throws:
XmlPullParserException
-
getPrefix
- Specified by:
getPrefixin interfaceXmlPullParser
-
getTextCharacters
public char[] getTextCharacters(int[] holderForStartAndLength)- Specified by:
getTextCharactersin interfaceXmlPullParser
-
getNamespace
- Specified by:
getNamespacein interfaceXmlPullParser
-
getName
- Specified by:
getNamein interfaceXmlPullParser
-
getAttribute
-
getAttributeNamespace
- Specified by:
getAttributeNamespacein interfaceAttributeSet- Specified by:
getAttributeNamespacein interfaceXmlPullParser- Specified by:
getAttributeNamespacein interfaceXmlResourceParser
-
getAttributeName
- Specified by:
getAttributeNamein interfaceAttributeSet- Specified by:
getAttributeNamein interfaceXmlPullParser
-
getAttributePrefix
- Specified by:
getAttributePrefixin interfaceXmlPullParser
-
isEmptyElementTag
- Specified by:
isEmptyElementTagin interfaceXmlPullParser- Throws:
XmlPullParserException
-
getAttributeCount
public int getAttributeCount()- Specified by:
getAttributeCountin interfaceAttributeSet- Specified by:
getAttributeCountin interfaceXmlPullParser
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceAttributeSet- Specified by:
getAttributeValuein interfaceXmlPullParser
-
qualify
-
getAttributeType
- Specified by:
getAttributeTypein interfaceXmlPullParser
-
isAttributeDefault
public boolean isAttributeDefault(int index)- Specified by:
isAttributeDefaultin interfaceXmlPullParser
-
nextToken
- Specified by:
nextTokenin interfaceXmlPullParser- Throws:
XmlPullParserExceptionIOException
-
getAttributeValue
- Specified by:
getAttributeValuein interfaceAttributeSet- Specified by:
getAttributeValuein interfaceXmlPullParser
-
next
- Specified by:
nextin interfaceXmlPullParser- Throws:
XmlPullParserExceptionIOException
-
require
public void require(int type, String namespace, String name) throws XmlPullParserException, IOException- Specified by:
requirein interfaceXmlPullParser- Throws:
XmlPullParserExceptionIOException
-
nextText
- Specified by:
nextTextin interfaceXmlPullParser- Throws:
XmlPullParserExceptionIOException
-
nextTag
- Specified by:
nextTagin interfaceXmlPullParser- Throws:
XmlPullParserExceptionIOException
-
getAttributeNameResource
public int getAttributeNameResource(int index)- Specified by:
getAttributeNameResourcein interfaceAttributeSet
-
getAttributeListValue
public int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue)- Specified by:
getAttributeListValuein interfaceAttributeSet
-
getAttributeBooleanValue
- Specified by:
getAttributeBooleanValuein interfaceAttributeSet
-
getAttributeResourceValue
- Specified by:
getAttributeResourceValuein interfaceAttributeSet
-
getAttributeIntValue
- Specified by:
getAttributeIntValuein interfaceAttributeSet
-
getAttributeUnsignedIntValue
- Specified by:
getAttributeUnsignedIntValuein interfaceAttributeSet
-
getAttributeFloatValue
- Specified by:
getAttributeFloatValuein interfaceAttributeSet
-
getAttributeListValue
- Specified by:
getAttributeListValuein interfaceAttributeSet
-
getAttributeBooleanValue
public boolean getAttributeBooleanValue(int idx, boolean defaultValue)- Specified by:
getAttributeBooleanValuein interfaceAttributeSet
-
getAttributeResourceValue
public int getAttributeResourceValue(int idx, int defaultValue)- Specified by:
getAttributeResourceValuein interfaceAttributeSet
-
getAttributeIntValue
public int getAttributeIntValue(int idx, int defaultValue)- Specified by:
getAttributeIntValuein interfaceAttributeSet
-
getAttributeUnsignedIntValue
public int getAttributeUnsignedIntValue(int idx, int defaultValue)- Specified by:
getAttributeUnsignedIntValuein interfaceAttributeSet
-
getAttributeFloatValue
public float getAttributeFloatValue(int idx, float defaultValue)- Specified by:
getAttributeFloatValuein interfaceAttributeSet
-
getIdAttribute
- Specified by:
getIdAttributein interfaceAttributeSet
-
getClassAttribute
- Specified by:
getClassAttributein interfaceAttributeSet
-
getIdAttributeResourceValue
public int getIdAttributeResourceValue(int defaultValue)- Specified by:
getIdAttributeResourceValuein interfaceAttributeSet
-
getStyleAttribute
public int getStyleAttribute()- Specified by:
getStyleAttributein interfaceAttributeSet
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceXmlResourceParser
-
finalize
-