Hello

I am new to android development, right now i am doing a simple project
that receive data from XML and display on screen.
for retrieving data from XMl file I have used Dom parser but at run
time it will throw an error. The SAX Exception   " input source needs
either stream or reader"

                Document dom;
                DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
                DocumentBuilder db = dbf.newDocumentBuilder();
                dom = db.parse("assets/myfile.xml");

This code is working fine with out side android or other java project.

I have tried for
               File f = new File ("assets/myfile.xml");
               InputStream str =  f.toURL().openStream();
               dom = db.parse(str);
and same for by using reader. but sill i got same kind of error,

Please tell me what is correct way to use Stream or Reader.

Thanks in advance :)



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

Reply via email to