>From the docs:

> public abstract void parse (String systemId)
>
> This method is a shortcut for the common case of reading a document from a 
> system identifier. It is the exact
> equivalent of the following:
>
> parse(new InputSource(systemId));

So the parse() method doesn't accept XML as a String input - it
accepts a path to a file. This is what causes your exception.

Where does your XML come from originally? The SAX parser is designed
to parse directly from a Stream, so wherever your XML is first loaded,
parse it there.

mafro


petunio wrote:
> Hi everyone
>
> I am trying to parse some data (wrapped in a String), that has xml
> format
> following is the code that I am using, with no much succes so far :(
>
>     private void parseXml(String str)
>     {
>         XMLReader myReader=null;
>
>         System.setProperty
> ("org.xml.sax.driver","org.xmlpull.v1.sax2.Driver");
>
>          try
>          {
>            myReader = XMLReaderFactory.createXMLReader();
>          }
>          catch (SAXException e)
>          {
>                  Log.i("activity","error  = "+e.toString());
>          }
>
>         try
>         {
>                 myReader.parse(str);
>         }
>         catch (IOException e)
>         {
>                 Log.i("activity","error  = "+e.toString());
>         }
>         catch (SAXException e)
>         {
>                 Log.i("activity","error  = "+e.toString());
>                 //it fails here!!!
>         }
>
> }
>
> when I do myReader.parse(str), I get the following error:
> java.io.FileNotFoundException
> I guess is because it's trying to acces a file, but what I am trying
> to parse is just some data that I have in the String variable, not a
> file...
>
> can anybody tell me what I am doing wrong?
>
> Thanks a lot
--~--~---------~--~----~------------~-------~--~----~
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