3

I'm using the XmlPullParser for parsing a xml file in Android. However i want to pause the parser whenever i want.

I use Filechannels, which i create from a RandomAccessFile. Then I create an Inputstream using the method Channels.newInputstream().

My idea was to store the position of each xml start tag, and when i pause and then resume the operation, i set the position of the filechannel to the previous stored one.

However i face the problem that the XMLPullParser uses a buffer of 8231 bytes. This means i can't know the exact position of the xml start tag.

I saw that the xmlpullparser has a getLineNumber() method, but i can't see any set method.

Has anyone an idea how i can know the exact position of the xml start tag inside the file ?

Best regards.

João Nunes
  • 711
  • 4
  • 11
  • 22
  • Most likely you'll have to implement your own, start with Android's version if it helps. (If you use a different parser don't use the factory as its hardcoded to use Android's modified version of kXML) – sergio91pt Jul 02 '12 at 17:55

0 Answers0