Thanks very much! I really appreciate it. I will give those options a
whirl!
Austen
On Jun 15, 4:55 am, Mark Murphy <[EMAIL PROTECTED]> wrote:
> Jufafs wrote:
> > 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.
>
> Possibly, but it's probably not worth it.
>
> > 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.
>
> Option #1: Use an XML resource instead. Put your file in /res/xml in
> your project tree, instead of /assets. Then, call
> getResources().getXml() from your activity to get an XmlPullParser:
>
> http://xmlpull.org/v1/doc/api/org/xmlpull/v1/package-summary.html
>
> Option #2: Keep the file in /assets, and use the DOM:
>
> InputStream is = getAssets().open("test.plist");
> DocumentBuilder builder=DocumentBuilderFactory
> .newInstance()
> .newDocumentBuilder();
> Document doc=builder.parse(is, null);
>
> Option #3: Use SAX. You would wrap your InputStream in an
> org.xml.sax.InputSource for feeding into the parser.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ -- Available Now!- Hide
> quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---