Parse XML string using SAX

Rui Gonçalves picture Rui Gonçalves · Dec 5, 2009 · Viewed 26.4k times · Source

Is there any way to parse an XML string using Android SAX?

Answer

Matthias picture Matthias · Dec 5, 2009

Yes, first define a SAX ContentHandler:

class MyXmlContentHandler extends DefaultHandler {
   ... // implement SAX callbacks here
}

then you can use the Xml utility class:

Xml.parse(xmlString, new MyXmlContentHandler());