1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
try {
/** Handling XML */
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
Log.v("i begin parsing at :", ""+hours+"h "+minutes+"min "+seconds+"sec");
l1=(hours*60*60)+(minutes*60)+(seconds);
/** Send URL to parse XML Tags */
URL sourceUrl = new URL("http://sociable.co/wp-content/uploads/2011/04/android-wallpaper.png");
URLConnection urlConnection = sourceUrl.openConnection();
urlConnection.connect();
int file_size = urlConnection.getContentLength();
Log.v("the size of this file is : ", ""+file_size);
/** Create handler to handle XML Tags ( extends DefaultHandler ) */
MyXMLHandler myXMLHandler = new MyXMLHandler();
xr.setContentHandler(myXMLHandler);
xr.parse(new InputSource(sourceUrl.openStream()));
} catch (Exception e) {
System.out.println("XML Pasing Excpetion = " + e);
} |
Partager