/** * Returns the next XML event for the document being parsed. * * @return The next XML event for the document being parsed. * * @throws XMLStreamException */ public XMLEvent nextEvent() throws XMLStreamException { if (attributeIterator != null && attributeIterator.hasNext()) { currentEvent = (XMLEvent)attributeIterator.next(); } else { currentEvent = eventReader.nextEvent(); } if (currentEvent.isStartElement()) { attributeIterator = currentEvent.asStartElement().getAttributes(); } updateContext(currentEvent); if (eventReader.hasNext()) { XMLEvent nextEvent = eventReader.peek(); if (nextEvent != null && nextEvent.isCharacters()) { for (MetadataExpression metadataExpression : metadataExpressions) { if (testExpression(metadataExpression.expression, metadataExpression.targetDepth)) { metadata.put(metadataExpression.key, nextEvent.asCharacters().getData()); } } } } return currentEvent; }
/** * Returns the text contents of the current element being parsed. * * @return The text contents of the current element being parsed. * @throws IOException * @throws XmlPullParserException */ public String readText() throws XmlPullParserException, IOException { String s = xpp.nextText(); // Warning: Prior to API level 14, the pull parser returned by // android.util.Xml did not always advance to the END_TAG event when // this method was called. Work around by using manually advancing after // calls to nextText(): if (xpp.getEventType() != XmlPullParser.END_TAG) { xpp.next(); } currentEventType = xpp.getEventType(); updateContext(); return s; }
/** * Returns the next XML event for the document being parsed. * * @return The next XML event for the document being parsed. * * @throws XMLStreamException */ public XMLEvent nextEvent() throws XMLStreamException { if (attributeIterator != null && attributeIterator.hasNext()) { currentEvent = (XMLEvent)attributeIterator.next(); } else { currentEvent = eventReader.nextEvent(); } if (currentEvent.isStartElement()) { attributeIterator = currentEvent.asStartElement().getAttributes(); } updateContext(currentEvent); if (eventReader.hasNext()) { XMLEvent nextEvent = eventReader.peek(); if (nextEvent != null && nextEvent.isCharacters()) { for (MetadataExpression metadataExpression : metadataExpressions) { if (testExpression(metadataExpression.expression, metadataExpression.targetDepth)) { metadata.put(metadataExpression.key, nextEvent.asCharacters().getData()); } } } } return currentEvent; }
/** * Returns the next XML event for the document being parsed. It's one of * XmlPullParser.START_DOCUMENT,XmlPullParser.END_DOCUMENT, * XmlPullParser.START_TAG, XmlPullParser.END_TAG. * * @return The next XML event for the document being parsed. * @throws IOException * @throws XmlPullParserException */ public int nextEvent() throws XmlPullParserException, IOException { currentEventType = xpp.next(); // skip text node if (currentEventType == XmlPullParser.TEXT) { currentEventType = xpp.next(); } updateContext(); // look for meta data if (currentEventType == XmlPullParser.START_TAG) { for (MetadataExpression metadataExpression : metadataExpressions) { if (testExpression(metadataExpression.expression, metadataExpression.targetDepth)) { metadata.put(metadataExpression.key, readText()); break; } } } return currentEventType; }
/** * Returns the text contents of the current element being parsed. * * @return The text contents of the current element being parsed. * @throws IOException * @throws XmlPullParserException */ public String readText() throws XmlPullParserException, IOException { String s = xpp.nextText(); // Warning: Prior to API level 14, the pull parser returned by // android.util.Xml did not always advance to the END_TAG event when // this method was called. Work around by using manually advancing after // calls to nextText(): if (xpp.getEventType() != XmlPullParser.END_TAG) { xpp.next(); } currentEventType = xpp.getEventType(); updateContext(); return s; }
/** * Returns the text contents of the current element being parsed. * * @return The text contents of the current element being parsed. * @throws IOException * @throws XmlPullParserException */ public String readText() throws XmlPullParserException, IOException { String s = xpp.nextText(); // Warning: Prior to API level 14, the pull parser returned by // android.util.Xml did not always advance to the END_TAG event when // this method was called. Work around by using manually advancing after // calls to nextText(): if (xpp.getEventType() != XmlPullParser.END_TAG) { xpp.next(); } currentEventType = xpp.getEventType(); updateContext(); return s; }
/** * Returns the next XML event for the document being parsed. * * @return The next XML event for the document being parsed. * * @throws XMLStreamException */ public XMLEvent nextEvent() throws XMLStreamException { if (attributeIterator != null && attributeIterator.hasNext()) { currentEvent = (XMLEvent)attributeIterator.next(); } else { currentEvent = eventReader.nextEvent(); } if (currentEvent.isStartElement()) { attributeIterator = currentEvent.asStartElement().getAttributes(); } updateContext(currentEvent); if (eventReader.hasNext()) { XMLEvent nextEvent = eventReader.peek(); if (nextEvent != null && nextEvent.isCharacters()) { for (MetadataExpression metadataExpression : metadataExpressions) { if (testExpression(metadataExpression.expression, metadataExpression.targetDepth)) { metadata.put(metadataExpression.key, nextEvent.asCharacters().getData()); } } } } return currentEvent; }
/** * Returns the next XML event for the document being parsed. It's one of * XmlPullParser.START_DOCUMENT,XmlPullParser.END_DOCUMENT, * XmlPullParser.START_TAG, XmlPullParser.END_TAG. * * @return The next XML event for the document being parsed. * @throws IOException * @throws XmlPullParserException */ public int nextEvent() throws XmlPullParserException, IOException { currentEventType = xpp.next(); // skip text node if (currentEventType == XmlPullParser.TEXT) { currentEventType = xpp.next(); } updateContext(); // look for meta data if (currentEventType == XmlPullParser.START_TAG) { for (MetadataExpression metadataExpression : metadataExpressions) { if (testExpression(metadataExpression.expression, metadataExpression.targetDepth)) { metadata.put(metadataExpression.key, readText()); break; } } } return currentEventType; }
/** * Returns the next XML event for the document being parsed. It's one of * XmlPullParser.START_DOCUMENT,XmlPullParser.END_DOCUMENT, * XmlPullParser.START_TAG, XmlPullParser.END_TAG. * * @return The next XML event for the document being parsed. * @throws IOException * @throws XmlPullParserException */ public int nextEvent() throws XmlPullParserException, IOException { currentEventType = xpp.next(); // skip text node if (currentEventType == XmlPullParser.TEXT) { currentEventType = xpp.next(); } updateContext(); // look for meta data if (currentEventType == XmlPullParser.START_TAG) { for (MetadataExpression metadataExpression : metadataExpressions) { if (testExpression(metadataExpression.expression, metadataExpression.targetDepth)) { metadata.put(metadataExpression.key, readText()); break; } } } return currentEventType; }