XmlResourceParser, AttributeSet, AutoCloseable, XmlPullParserpublic class XmlResourceParserImpl extends Object implements XmlResourceParser
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.| 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.
|
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 | Description |
|---|---|
XmlResourceParserImpl(Document document,
String fileName,
String packageName,
String applicationPackageName,
ResourceTable resourceTable) |
Deprecated.
|
XmlResourceParserImpl(Document document,
Path fileName,
String packageName,
String applicationPackageName,
ResourceTable resourceTable) |
public static final String[] AVAILABLE_FEATURES
public static final String[] UNAVAILABLE_FEATURES
@Deprecated public XmlResourceParserImpl(Document document, String fileName, String packageName, String applicationPackageName, ResourceTable resourceTable)
XmlResourceParserImpl(Document, Path, String,
String, ResourceTable) instead.public XmlResourceParserImpl(Document document, Path fileName, String packageName, String applicationPackageName, ResourceTable resourceTable)
public void setFeature(String name, boolean state) throws XmlPullParserException
setFeature in interface XmlPullParserXmlPullParserExceptionpublic boolean getFeature(String name)
getFeature in interface XmlPullParserpublic void setProperty(String name, Object value) throws XmlPullParserException
setProperty in interface XmlPullParserXmlPullParserExceptionpublic Object getProperty(String name)
getProperty in interface XmlPullParserpublic void setInput(Reader in) throws XmlPullParserException
setInput in interface XmlPullParserXmlPullParserExceptionpublic void setInput(InputStream inputStream, String inputEncoding) throws XmlPullParserException
setInput in interface XmlPullParserXmlPullParserExceptionpublic void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException
defineEntityReplacementText in interface XmlPullParserXmlPullParserExceptionpublic String getNamespacePrefix(int pos) throws XmlPullParserException
getNamespacePrefix in interface XmlPullParserXmlPullParserExceptionpublic String getInputEncoding()
getInputEncoding in interface XmlPullParserpublic String getNamespace(String prefix)
getNamespace in interface XmlPullParserpublic int getNamespaceCount(int depth)
throws XmlPullParserException
getNamespaceCount in interface XmlPullParserXmlPullParserExceptionpublic String getPositionDescription()
getPositionDescription in interface AttributeSetgetPositionDescription in interface XmlPullParserpublic String getNamespaceUri(int pos) throws XmlPullParserException
getNamespaceUri in interface XmlPullParserXmlPullParserExceptionpublic int getColumnNumber()
getColumnNumber in interface XmlPullParserpublic int getDepth()
getDepth in interface XmlPullParserpublic String getText()
getText in interface XmlPullParserpublic int getLineNumber()
getLineNumber in interface XmlPullParserpublic int getEventType()
throws XmlPullParserException
getEventType in interface XmlPullParserXmlPullParserExceptionpublic boolean isWhitespace(String text) throws XmlPullParserException
XmlPullParserExceptionpublic boolean isWhitespace()
throws XmlPullParserException
isWhitespace in interface XmlPullParserXmlPullParserExceptionpublic String getPrefix()
getPrefix in interface XmlPullParserpublic char[] getTextCharacters(int[] holderForStartAndLength)
getTextCharacters in interface XmlPullParserpublic String getNamespace()
getNamespace in interface XmlPullParserpublic String getName()
getName in interface XmlPullParserpublic String getAttributeNamespace(int index)
getAttributeNamespace in interface AttributeSetgetAttributeNamespace in interface XmlPullParsergetAttributeNamespace in interface XmlResourceParserpublic String getAttributeName(int index)
getAttributeName in interface AttributeSetgetAttributeName in interface XmlPullParserpublic String getAttributePrefix(int index)
getAttributePrefix in interface XmlPullParserpublic boolean isEmptyElementTag()
throws XmlPullParserException
isEmptyElementTag in interface XmlPullParserXmlPullParserExceptionpublic int getAttributeCount()
getAttributeCount in interface AttributeSetgetAttributeCount in interface XmlPullParserpublic String getAttributeValue(int index)
getAttributeValue in interface AttributeSetgetAttributeValue in interface XmlPullParserpublic String getAttributeType(int index)
getAttributeType in interface XmlPullParserpublic boolean isAttributeDefault(int index)
isAttributeDefault in interface XmlPullParserpublic int nextToken()
throws XmlPullParserException,
IOException
nextToken in interface XmlPullParserXmlPullParserExceptionIOExceptionpublic String getAttributeValue(String namespace, String name)
getAttributeValue in interface AttributeSetgetAttributeValue in interface XmlPullParserpublic int next()
throws XmlPullParserException,
IOException
next in interface XmlPullParserXmlPullParserExceptionIOExceptionpublic void require(int type,
String namespace,
String name)
throws XmlPullParserException,
IOException
require in interface XmlPullParserXmlPullParserExceptionIOExceptionpublic String nextText() throws XmlPullParserException, IOException
nextText in interface XmlPullParserXmlPullParserExceptionIOExceptionpublic int nextTag()
throws XmlPullParserException,
IOException
nextTag in interface XmlPullParserXmlPullParserExceptionIOExceptionpublic int getAttributeNameResource(int index)
getAttributeNameResource in interface AttributeSetpublic int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue)
getAttributeListValue in interface AttributeSetpublic boolean getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue)
getAttributeBooleanValue in interface AttributeSetpublic int getAttributeResourceValue(String namespace, String attribute, int defaultValue)
getAttributeResourceValue in interface AttributeSetpublic int getAttributeIntValue(String namespace, String attribute, int defaultValue)
getAttributeIntValue in interface AttributeSetpublic int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue)
getAttributeUnsignedIntValue in interface AttributeSetpublic float getAttributeFloatValue(String namespace, String attribute, float defaultValue)
getAttributeFloatValue in interface AttributeSetpublic int getAttributeListValue(int idx,
String[] options,
int defaultValue)
getAttributeListValue in interface AttributeSetpublic boolean getAttributeBooleanValue(int idx,
boolean defaultValue)
getAttributeBooleanValue in interface AttributeSetpublic int getAttributeResourceValue(int idx,
int defaultValue)
getAttributeResourceValue in interface AttributeSetpublic int getAttributeIntValue(int idx,
int defaultValue)
getAttributeIntValue in interface AttributeSetpublic int getAttributeUnsignedIntValue(int idx,
int defaultValue)
getAttributeUnsignedIntValue in interface AttributeSetpublic float getAttributeFloatValue(int idx,
float defaultValue)
getAttributeFloatValue in interface AttributeSetpublic String getIdAttribute()
getIdAttribute in interface AttributeSetpublic String getClassAttribute()
getClassAttribute in interface AttributeSetpublic int getIdAttributeResourceValue(int defaultValue)
getIdAttributeResourceValue in interface AttributeSetpublic int getStyleAttribute()
getStyleAttribute in interface AttributeSetpublic void close()
close in interface AutoCloseableclose in interface XmlResourceParser