well i have an android app that needs to be updated with data... i know what to do on android-end for xml parsing... but when i try to parse the data through the follwing xml fi
You should follow the tutorial that I posted on the duplicate of this question here: Parsed XML data not retrieving in android
Although that tutorial does not show getting attributes.
In short, your startElement
should look something like this:
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if(localName.equals("stuff")){
String element=attributes.getValue("code");
info.setData(element); //element will hold "firststuff" on the first execution
}
}
You will need a separate if
for each name you are trying to match.
Xml files in general are referred to like this (using your naming convention):
So the if
statement above will handle the lines <..."secondstuff">
etc. but you will have to add more to handle each different line.
I strongly suggest you follow a tutorial to get this accomplished, although, you will definitely learn a lot through trial and error.