Hi All,
I found an example on the internet that reads in XML files and can
parse out the elements that I am interested in. In regular Java (not
an android project) I just used:
File file = new File("C:\\textfiles\\test.plist");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
doc.getDocumentElement().normalize();
NodeList nodeLst = doc.getElementsByTagName("element1");
.
.
. ..stuff that iterates through the file and parses the elements i'm
interested in....
I'm able to parse out the elements I want and output them to the
screen as Strings.
However, in the android project I'm working on I'm trying to do the
same thing. I put an XML file in the assets folder called
"test.plist". It's basically just some XML. The same file I was able
to read above.
However, my problem is that the only way I can see to open this file
is using:
InputStream is = getAssets().open("test.plist");
I'm kind of a noob to programming in general so I don't know how to
use the InputStream to parse the file and basically extract the data
from the XML file that I want.
Questions:
1) Is there anyway for me to open the "test.plist" file in the asset
folder as a File class rather than an InputStream class.
2) If that is not possible do you have any suggestions on how to
either convert the InputStream into a File or any ideas on how to
parse the XML file using an InputStream instead.
Thanks very much for any and all help! It's much appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---