I googled it and didn't find an answer - may be I didn't search it right.

My question is I'm parsing xml from the beginnning to the end of document - one way. What if somewhere in the middle I need to set parser to go to the Start of Document again?

I know only myXmlPullParser.next(); (or any other next) to move forward, but I need at some condition to start parsing from the beginning of document again. Is it possible?

有帮助吗?

解决方案

Is it possible?

Sure. Create a new pull parser instance, using the same code as you used to create the first one. Or, try calling setInput() on your existing instance, providing it a fresh copy of the data.

其他提示

If it is reading from a file (or network) I am thinking that caching the data in an input stream and reading it back into the parser may be the fastest route. I will work up an example

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top