int eventType = parser.getEventType();
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
int eventType = parser.getEventType(); while ( eventType != XmlPullParser.END_DOCUMENT )
/** * Method read. * * @param parser * @param strict * @throws IOException * @throws XmlPullParserException * @return Model */ private Model read( XmlPullParser parser, boolean strict ) throws IOException, XmlPullParserException { int eventType = parser.getEventType(); while ( eventType != XmlPullParser.END_DOCUMENT ) { if ( eventType == XmlPullParser.START_TAG ) { if ( strict && ! "project".equals( parser.getName() ) ) { throw new XmlPullParserException( "Expected root element 'project' but found '" + parser.getName() + "'", parser, null ); } Model model = parseModel( parser, strict ); model.setModelEncoding( parser.getInputEncoding() ); return model; } eventType = parser.next(); } throw new XmlPullParserException( "Expected root element 'project' but found no element at all: invalid XML document", parser, null ); } //-- Model read( XmlPullParser, boolean )
int eventType = parser.getEventType(); boolean parsed = false; while ( eventType != XmlPullParser.END_DOCUMENT )
/** * Checks that a given parser is not at the end of the xml document. * * @param parser the parser to check * @param tagName the endign tag's name * @throws XmlPullParserException if the parser is at the end of the xml * stream, instead of the {@code tagName} * ending tag */ protected void checkNotEndOfXml(XmlPullParser parser, String tagName) throws XmlPullParserException { if (parser.getEventType() == XmlPullParser.END_DOCUMENT) { // can not be here ? throw new XmlPullParserException( "end of document found... but required at least the " + "ending tag " + tagName); } }
/** * Checks that a given parser is not at the end of the xml document. * * @param parser the parser to check * @param tagName the endign tag's name * @throws XmlPullParserException if the parser is at the end of the xml * stream, instead of the {@code tagName} * ending tag */ protected void checkNotEndOfXml(XmlPullParser parser, String tagName) throws XmlPullParserException { if (parser.getEventType() == XmlPullParser.END_DOCUMENT) { // can not be here ? throw new XmlPullParserException( "end of document found... but required at least the " + "ending tag " + tagName); } }
protected int gotoNextOpenTag(String tagName, XmlPullParser parser) throws XmlPullParserException, IOException { // search next open tag tagName int eventType = parser.getEventType(); while (eventType != XmlPullParser.START_TAG || !parser.getName().equals(tagName)) { checkNotEndOfXml(parser, tagName); eventType = parser.next(); } return eventType; }
protected int gotoNextOpenTag(String tagName, XmlPullParser parser) throws XmlPullParserException, IOException { // search next open tag tagName int eventType = parser.getEventType(); while (eventType != XmlPullParser.START_TAG || !parser.getName().equals(tagName)) { checkNotEndOfXml(parser, tagName); eventType = parser.next(); } return eventType; }
/** * Checks that a given parser is at the end of the xml document. * * @param parser the parser to check * @throws XmlPullParserException if the parser is not at the end of the * xml stream. */ protected void checkEndOfXml(XmlPullParser parser) throws XmlPullParserException { // must be at the end of the document if (parser.getEventType() != XmlPullParser.END_DOCUMENT) { throw new XmlPullParserException( "should be at the end of document but was not... : " + parser.getName()); } }
/** * Checks that a given parser is at the end of the xml document. * * @param parser the parser to check * @throws XmlPullParserException if the parser is not at the end of the * xml stream. */ protected void checkEndOfXml(XmlPullParser parser) throws XmlPullParserException { // must be at the end of the document if (parser.getEventType() != XmlPullParser.END_DOCUMENT) { throw new XmlPullParserException( "should be at the end of document but was not... : " + parser.getName()); } } }