문제

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