I have the following type of XML that I’m trying to parse.

The code that I’m using to parse is this one:
parser.nextTag();
parser.require(XmlPullParser.START_TAG, null, "feed");
while(parser.nextTag() == XmlPullParser.START_TAG) {
parser.require(XmlPullParser.START_TAG, null, "item");
System.out.println(parser.getName());
parser.require(XmlPullParser.END_TAG, null, "item");
}
Could someone please tell me what I’m doing wrong? The error I’m getting is XmlPullParserException unexpected type position: TEXT SORIN
parser.getName()gives you the name of the current tag (e.g. “item”). You want the text content of the current tag.Change
System.out.println(parser.getName());toIt will still fail at the
atomtag because it has no text, but I think you get the idea. Well, actually it will fail at theatomtag because you expect onlyitemtags, but again that wasn’t really the question.