In fact it seems that startDocment and endDocument are invoked when using my original code, with no warning about DTD handlers... so how do i get the other methods to be invoked??
2009/12/19 redders <[email protected]> > Update: > Using Mark's method, startDocument and endDocument are invoked, but > never the elements... > > On Dec 19, 5:19 pm, Edward Hinchliffe <[email protected]> > wrote: > > Thanks Mark, I've just given that a try. I still don't get any calls to > my > > startElement method, but there is a new warning which may be a clue: > > > > 12-19 17:14:24.241: INFO/NWXML(1852): Trying to parse: *snip* > > 12-19 17:14:24.241: WARN/ExpatReader(1852): DTD handlers aren't > supported. > > > > DTD handlers aren't supported. Know what this means? > > > > 2009/12/19 Mark Murphy <[email protected]> > > > > > > > > > redders wrote: > > > > I appreciate the reply, but I selected the SAX method because of its > > > > efficiency advantages, so I'd really like to understand why my code > > > > isn't working. > > > > > I don't use XMLReader and I have no problems with SAX on Android, such > > > as this one parsing a XML payload from a REST request: > > > > > BufferedReader in=new BufferedReader(new > > > InputStreamReader(url.openStream())); > > > SAXParserFactory f=SAXParserFactory.newInstance(); > > > SAXParser p=f.newSAXParser(); > > > SearchParser parser=new SearchParser(null); > > > p.parse(new InputSource(in), parser); > > > > > (where SearchParser is a DefaultHandler subclass) > > > > > In your case, this would look like: > > > > > SAXParserFactory f=SAXParserFactory.newInstance(); > > > SAXParser p=f.newSAXParser(); > > > StringReader sr = new StringReader(xmlMessage); > > > InputSource is = new InputSource(sr); > > > p.parse(is, this); > > > > > Try something like that and see if it helps. > > > > > -- > > > Mark Murphy (a Commons Guy) > > >http://commonsware.com|http://twitter.com/commonsguy > > > > > _Android Programming Tutorials_ Version 1.0 In Print! > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<android-developers%[email protected]><android-developers%2Bunsubs > [email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

