xml parsing in android(new)

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

xml parsing in android(new)

Postby hPushpa18 » Tue Nov 03, 2009 6:01 am

i have an xml file.I need to parse the data(here the questions)and answers as well from this xml and should extract it in .java file of the same project.I have attached the file can u plz help me with this

Thank you
Attachments
FP_CCNA_ICND.txt
xml
(241.7 KiB) Downloaded 108 times
hPushpa18
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Nov 02, 2009 11:08 am
Location: Bangalore

Top

Postby ExxKA » Sun Nov 08, 2009 5:41 pm

No problem. You just load the content into a Dom Document, then you can parse the values easily.

look at org.w3c.dom in the Android API - That's where you need to start. You can also use the SAX parser if you wish. I have no experience with that though. I have found the dom parser very easy to use.

You need to start a DocumentBuilderFactory first, then a DocumentBuilder and then a Document. I know it's cumbersome. But that's the way to do it.
ExxKA
Developer
Developer
 
Posts: 29
Joined: Tue Nov 03, 2009 7:16 pm
Location: Denmark

Re: xml parsing in android(new)

Postby vunguyen » Wed Nov 11, 2009 9:14 am

hPushpa18 wrote:i have an xml file.I need to parse the data(here the questions)and answers as well from this xml and should extract it in .java file of the same project.I have attached the file can u plz help me with this

Thank you


Hi there,

You can refer in this tutorial: http://www.anddev.org/parsing_xml_from_ ... -s165.html
KL&KL
vunguyen
Freshman
Freshman
 
Posts: 6
Joined: Sat Oct 10, 2009 10:42 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests