Kumar Bibek wrote:
> Instead of res/xml folder, Put it in the assets folder or the sdcard,
> and read it from there.
> 
> You will find examples on how to do it.
> http://www.codeweblog.com/how-to-read-the-assets-directory-resources/

Why?

Why not use res/xml/? That is why it is there. Reading in the XML will
be 10x faster than from assets/, and it will take up less space in the
APK to boot.

>> What is the easiest way to read an xml file?
>> How is the best way to store the information from the xml?
>>
>> I have tried to find a good tutorial, but I just can't get it to work :
>> (
>>
>> I have an xml file in /res/xml called myxml.xml which looks like this:
>>
>> <?xml version="1.0"?>
>> <school>
>>         <student>
>>                 <fname>Ola</fname>
>>                 <lname>Nordmann</lname>
>>         </student>
>> </school>
>>
>> I just want a simple way to read and store.

getResources().getXml() will give you an XmlPullParser on your XML document.

Here is a sample project demonstrating this:

http://github.com/commonsguy/cw-android/tree/master/Resources/XML/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.5 Available!

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

Reply via email to