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.
Modifier and Type | Field and 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 and Description |
---|
XmlResourceParserImpl(Document document,
Path fileName,
String packageName,
String applicationPackageName,
ResourceTable resourceTable) |
XmlResourceParserImpl(Document document,
String fileName,
String packageName,
String applicationPackageName,
ResourceTable resourceTable)
Deprecated.
|
public static final String[] AVAILABLE_FEATURES
All the parser features currently supported by Android.
public static final String[] UNAVAILABLE_FEATURES
All the parser features currently NOT supported by Android.
@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 XmlPullParser
XmlPullParserException
public boolean getFeature(String name)
getFeature
in interface XmlPullParser
public void setProperty(String name, Object value) throws XmlPullParserException
setProperty
in interface XmlPullParser
XmlPullParserException
public Object getProperty(String name)
getProperty
in interface XmlPullParser
public void setInput(Reader in) throws XmlPullParserException
setInput
in interface XmlPullParser
XmlPullParserException
public void setInput(InputStream inputStream, String inputEncoding) throws XmlPullParserException
setInput
in interface XmlPullParser
XmlPullParserException
public void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException
defineEntityReplacementText
in interface XmlPullParser
XmlPullParserException
public String getNamespacePrefix(int pos) throws XmlPullParserException
getNamespacePrefix
in interface XmlPullParser
XmlPullParserException
public String getInputEncoding()
getInputEncoding
in interface XmlPullParser
public String getNamespace(String prefix)
getNamespace
in interface XmlPullParser
public int getNamespaceCount(int depth) throws XmlPullParserException
getNamespaceCount
in interface XmlPullParser
XmlPullParserException
public String getPositionDescription()
getPositionDescription
in interface AttributeSet
getPositionDescription
in interface XmlPullParser
public String getNamespaceUri(int pos) throws XmlPullParserException
getNamespaceUri
in interface XmlPullParser
XmlPullParserException
public int getColumnNumber()
getColumnNumber
in interface XmlPullParser
public int getDepth()
getDepth
in interface XmlPullParser
public String getText()
getText
in interface XmlPullParser
public int getLineNumber()
getLineNumber
in interface XmlPullParser
public int getEventType() throws XmlPullParserException
getEventType
in interface XmlPullParser
XmlPullParserException
public boolean isWhitespace(String text) throws XmlPullParserException
XmlPullParserException
public boolean isWhitespace() throws XmlPullParserException
isWhitespace
in interface XmlPullParser
XmlPullParserException
public String getPrefix()
getPrefix
in interface XmlPullParser
public char[] getTextCharacters(int[] holderForStartAndLength)
getTextCharacters
in interface XmlPullParser
public String getNamespace()
getNamespace
in interface XmlPullParser
public String getName()
getName
in interface XmlPullParser
public String getAttributeNamespace(int index)
getAttributeNamespace
in interface XmlResourceParser
getAttributeNamespace
in interface AttributeSet
getAttributeNamespace
in interface XmlPullParser
public String getAttributeName(int index)
getAttributeName
in interface AttributeSet
getAttributeName
in interface XmlPullParser
public String getAttributePrefix(int index)
getAttributePrefix
in interface XmlPullParser
public boolean isEmptyElementTag() throws XmlPullParserException
isEmptyElementTag
in interface XmlPullParser
XmlPullParserException
public int getAttributeCount()
getAttributeCount
in interface AttributeSet
getAttributeCount
in interface XmlPullParser
public String getAttributeValue(int index)
getAttributeValue
in interface AttributeSet
getAttributeValue
in interface XmlPullParser
public String getAttributeType(int index)
getAttributeType
in interface XmlPullParser
public boolean isAttributeDefault(int index)
isAttributeDefault
in interface XmlPullParser
public int nextToken() throws XmlPullParserException, IOException
nextToken
in interface XmlPullParser
XmlPullParserException
IOException
public String getAttributeValue(String namespace, String name)
getAttributeValue
in interface AttributeSet
getAttributeValue
in interface XmlPullParser
public int next() throws XmlPullParserException, IOException
next
in interface XmlPullParser
XmlPullParserException
IOException
public void require(int type, String namespace, String name) throws XmlPullParserException, IOException
require
in interface XmlPullParser
XmlPullParserException
IOException
public String nextText() throws XmlPullParserException, IOException
nextText
in interface XmlPullParser
XmlPullParserException
IOException
public int nextTag() throws XmlPullParserException, IOException
nextTag
in interface XmlPullParser
XmlPullParserException
IOException
public int getAttributeNameResource(int index)
getAttributeNameResource
in interface AttributeSet
public int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue)
getAttributeListValue
in interface AttributeSet
public boolean getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue)
getAttributeBooleanValue
in interface AttributeSet
public int getAttributeResourceValue(String namespace, String attribute, int defaultValue)
getAttributeResourceValue
in interface AttributeSet
public int getAttributeIntValue(String namespace, String attribute, int defaultValue)
getAttributeIntValue
in interface AttributeSet
public int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue)
getAttributeUnsignedIntValue
in interface AttributeSet
public float getAttributeFloatValue(String namespace, String attribute, float defaultValue)
getAttributeFloatValue
in interface AttributeSet
public int getAttributeListValue(int idx, String[] options, int defaultValue)
getAttributeListValue
in interface AttributeSet
public boolean getAttributeBooleanValue(int idx, boolean defaultValue)
getAttributeBooleanValue
in interface AttributeSet
public int getAttributeResourceValue(int idx, int defaultValue)
getAttributeResourceValue
in interface AttributeSet
public int getAttributeIntValue(int idx, int defaultValue)
getAttributeIntValue
in interface AttributeSet
public int getAttributeUnsignedIntValue(int idx, int defaultValue)
getAttributeUnsignedIntValue
in interface AttributeSet
public float getAttributeFloatValue(int idx, float defaultValue)
getAttributeFloatValue
in interface AttributeSet
public String getIdAttribute()
getIdAttribute
in interface AttributeSet
public String getClassAttribute()
getClassAttribute
in interface AttributeSet
public int getIdAttributeResourceValue(int defaultValue)
getIdAttributeResourceValue
in interface AttributeSet
public int getStyleAttribute()
getStyleAttribute
in interface AttributeSet
public void close()
close
in interface XmlResourceParser
close
in interface AutoCloseable