I have been trying to use SAX XML parser to access some data on a server but no matter how tried how many different tutorials I applied and approaches tested the data variable would come up empty every time.
I tried using local files but with success either.
Finally in some tutorials comments I red that from 3,0+ api Android changed method to get and stream files. I found out that I need to create a different thread to stream data. Could you help me I just need to get these lines working:
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
URL url = new URL("http://www.xmlfiles.com/examples/cd_catalog.xml"); // URL of the XML
/**
* Create the Handler to handle each of the XML tags.
**/
XMLHandler myXMLHandler = new XMLHandler();
xmlR.setContentHandler(myXMLHandler);
xmlR.parse(new InputSource(url.openStream()));