Hi, We need to convert XML messages to a stream or string which can then be sent via sockets. However, Android does not support the standard javax classes that are used to convert a DOM XML object to a stream. Besides, as far as I know, DOM parser reads all of the XML document into the memory before allowing to use the DOM APIs to transverse the XML tree in order to retrieve the data you want. This may be simpler than the SAX-based implementations, however DOM generally consumes more memory as everything is read into the memory first although this won't effect the performance on a mobile device much, unless the size of the XML document is large.
On the other hand, using SAX or XML pull parser may be better options due to the extra utilities provided for them. XML PullParser works similarly to StAX which is also not supported by the Android platform. This class seems to allow your application code to pull or seek events from the parser, as opposed to the SAX parser which automatically pushes events to the handler. You can also set a flag to identify when you reach the end of the content that you are interested in. This lets you halt the reading of the XML document early, as you know that the code will not care about the rest of the document. This can be very useful, especially if you only need a small portion of the XML document being accessed. That means you can reduce the parsing time by stopping the parsing as soon as possible especially when the size of the XML document is large. I was wondering whether anybody, who has experience using the XmlPullParser class or others on the Android platform, has anything to say about its efficiency, well-known problems if any, suggestions for a better alternative, links for sample code etc. Cheers, Emre _________________________________________________________________ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en