I'm creating an App using LWUIT and part of its functionality is as thus, I'm using KXML 2_2-3-0 to parse my Xml files. I'm parsing two files, an XML file and an RSS feed.
This is the structure of my XML file:
<?xml version="....<the usual stuff>.....>
<kenya>
<county>
<name>Nairobi</name>
<population>Population: some figure</population>
<econ>Economy: Trade and Finance</econ>
<admin>Governor: None yet</admin>
<constituencies>Constituencies: Under Analysis</constituencies>
<desc>Overview: Some data</desc>
<irating>Rating: 8/10</irating>
</county>
<!--there are 46 more county nodes. -->
</kenya>
I'd like to have a combo box with a list of all the 47 counties, items in the combo box list should be the texts between <name></name>
tags. When a user selects an item in the combo box list, info for the selected item(in this case, county), is displayed. Example, from the above XML file, the combo box item should be Nairobi, when its selected, the following is displayed,
Population: some figure Economy: Trade and Finance Governor: None yet Constituencies: Under Analysis Overview: Some data Rating: 6/10
How do I do this? I've tried using getTitle
and defining the nodes but the app connects to the file(via http) but displays nothing(not even error messages). If you need to view the xml file further, just request.
Use the LWUIT XML parser, it works great!
Here you have an example. I did it long time ago.
XML parsing not working on android build of lwuit app
Hope it works!