Code I am using as:

          /* Create a new TextView to display the parsingresult later.
*/
          TextView tv = new TextView(this);
          try {
               /* Create a URL we want to load some xml-data from. */

             URL url = new URL("http://www.anddev.org/images/tut/basic/
parsingxml/example.xml");

               /* Get a SAXParser from the SAXPArserFactory. */
               SAXParserFactory spf = SAXParserFactory.newInstance();
               SAXParser sp = spf.newSAXParser();

               /* Get the XMLReader of the SAXParser we created. */
               XMLReader xr = sp.getXMLReader();
               /* Create a new ContentHandler and apply it to the XML-
Reader*/
               ExampleHandler myExampleHandler = new ExampleHandler
();
               xr.setContentHandler(myExampleHandler);

               /* Parse the xml-data from our URL. */

                xr.parse(new InputSource(url.openStream()));

               /* Parsing has finished. */

               /* Our ExampleHandler now provides the parsed data to
us. */
               ParsedExampleDataSet parsedExampleDataSet =
 
myExampleHandler.getParsedData();

               /* Set the result to be displayed in our GUI. */
               tv.setText(parsedExampleDataSet.toString());

          } catch (Exception e) {
               /* Display any Error to the GUI. */
               tv.setText("Error: " + e.getMessage());
               Log.e(MY_DEBUG_TAG, "WeatherQueryError", e);
          }
          /* Display the TextView. */
          this.setContentView(tv);
     }


In the above code at point

         /* Parse the xml-data from our URL. */

          xr.parse(new InputSource(url.openStream()));


an unknown error is occured and xml is also not parsed.
Please help me to solve this problem.


Thanks,
Dinesh Sharma

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to