@Override public void setFeature(String name, boolean value) throws XmlPullParserException { throw new XmlPullParserException(E_NOT_SUPPORTED); }
@Override public void defineEntityReplacementText(String entityName, String replacementText) throws XmlPullParserException { throw new XmlPullParserException(E_NOT_SUPPORTED); }
@Override public void setProperty(String name, Object value) throws XmlPullParserException { throw new XmlPullParserException(E_NOT_SUPPORTED); }
@Override public void setInput(Reader reader) throws XmlPullParserException { throw new XmlPullParserException(E_NOT_SUPPORTED); }
@Override public String getNamespacePrefix(int pos) throws XmlPullParserException { throw new XmlPullParserException( "getNamespacePrefix() not supported"); }
@Override public void setProperty(String name, Object value) throws XmlPullParserException { throw new XmlPullParserException("setProperty() not supported"); }
@Override public void defineEntityReplacementText( String entityName, String replacementText) throws XmlPullParserException { throw new XmlPullParserException( "defineEntityReplacementText() not supported"); }
@Override public int getNamespaceCount(int depth) throws XmlPullParserException { throw new XmlPullParserException( "getNamespaceCount() not supported"); }
@Override public void setInput(InputStream inputStream, String inputEncoding) throws XmlPullParserException { throw new XmlPullParserException("setInput() not supported"); }
@Override public String getNamespaceUri(int pos) throws XmlPullParserException { throw new XmlPullParserException( "getNamespaceUri() not supported"); }
@Override public void setInput(Reader in) throws XmlPullParserException { throw new XmlPullParserException("setInput() not supported"); }
public static final void beginDocument(XmlPullParser parser, String firstElementName) throws XmlPullParserException, IOException { int type; while ((type=parser.next()) != parser.START_TAG && type != parser.END_DOCUMENT) { } if (type != parser.START_TAG) { throw new XmlPullParserException("No start tag found"); } if (!parser.getName().equals(firstElementName)) { throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() + ", expected " + firstElementName); } }
@Override public void setFeature(String name, boolean state) throws XmlPullParserException { if (isAndroidSupportedFeature(name) && state) { return; } throw new XmlPullParserException("Unsupported feature: " + name); }
@Override public String nextText() throws XmlPullParserException, IOException { if (getEventType() != START_TAG) { throw new XmlPullParserException("Parser must be on START_TAG to read next text.", this, null); } int eventType = next(); if (eventType == TEXT) { String result = getText(); eventType = next(); if (eventType != END_TAG) { throw new XmlPullParserException("Event TEXT must be immediately followed by END_TAG.", this, null); } return result; } else if (eventType == END_TAG) { return ""; } else { throw new XmlPullParserException("Parser must be on START_TAG or TEXT to read text.", this, null); } }
@Override public void require(int type, String namespace, String name) throws XmlPullParserException, IOException { if (type != getEventType() || (namespace != null && !namespace.equals(getNamespace())) || (name != null && !name.equals(getName()))) { throw new XmlPullParserException(TYPES[type] + " is expected.", this, null); } }
static ColorStateList createFromXmlInner(Context context, XmlPullParser parser, AttributeSet attrs) throws IOException, XmlPullParserException { final String name = parser.getName(); if (!name.equals("selector")) { throw new XmlPullParserException( parser.getPositionDescription() + ": invalid color state list tag " + name); } return inflateColorStateList(context, parser, attrs); }
@Override public int next() throws XmlPullParserException, IOException { if (m_reader == null) { throw new XmlPullParserException("Parser is not opened.", this, null); } try { doNext(); return m_event; } catch (IOException e) { close(); throw e; } }
@Override public void require(int type, String namespace, String name) throws XmlPullParserException, IOException { if (type != getEventType() || (namespace != null && !namespace.equals(getNamespace())) || (name != null && !name.equals(getName()))) { throw new XmlPullParserException( "expected " + TYPES[type] + getPositionDescription()); } }
@Override public int nextTag() throws XmlPullParserException, IOException { int eventType = next(); if (eventType == TEXT && isWhitespace()) { eventType = next(); } if (eventType != START_TAG && eventType != END_TAG) { throw new XmlPullParserException("Expected start or end tag.", this, null); } return eventType; }
@Override public int nextTag() throws XmlPullParserException, IOException { int eventType = next(); if (eventType == TEXT && isWhitespace()) { // skip whitespace eventType = next(); } if (eventType != START_TAG && eventType != END_TAG) { throw new XmlPullParserException( "Expected start or end tag. Found: " + eventType, this, null); } return eventType; }