Here's roughly how I do it, for a GET request:

class RSS exends DefaultHandler {
    StringBuffer sb;
    ... other variables for collecting the data
    public void parse(URL url) throws Exception{
        SAXParserFactory spf = SAXParserFactory.*newInstance*();
        SAXParser parser = spf.newSAXParser();
        parser.parse(url.openConnection().getInputStream(), this);
    }
    @Override
    *public* *void* startElement(String namespaceUri, String localName,
String qName, Attributes attrs) {
       sb = new StringBuilder();
        ......
    }
    *...@override*
*    public void characters(char[] ch, int offset, int count) {*
*        sb.append(ch, offset, count);*
*    }*
*    @Override*
*    public* *void* endElement(String namespaceUri, String localName, String
qName) {
        if (localName.equals("someelement") {
             somevariable = sb.toString();
       }
       ...
    }
}

This is only a sketch, but it shows how easy the connection is made via
java.net and the skeleton of how the callbacks collect the data.

-- 
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

Reply via email to