Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top