Hi
I am trying to parse XML with a simple sax parser. Interestingly i am
able to see desired output in the emulator. but when i run the program
on a device program shows no output.
I tried many different way for example putting the XML file in a raw
folder but every time no out put on device. Tried this on two
different handset and everywhere get the same error.
<Code>
SAXParser saxParser =
SAXParserFactory.newInstance().newSAXParser();
DefaultHandler handler = new DefaultHandler() {
boolean id = false;
boolean stationName = false;
boolean latitude = false;
boolean longitude = false;
boolean ArivalTime = false;
boolean Train = false;
boolean bound = false;
@Override
public void startElement(String uri, String localName,
String qName, Attributes attributes)
throws SAXException {
if (qName.equalsIgnoreCase("id")) {
id = true;
}
if (qName.equalsIgnoreCase("myName")) {
myName = true;
}
}
@Override
public void characters(char ch[], int start, int length)
throws SAXException {
tv=(TextView)findViewById(R.id.text);
String st=new String();
if (id) {
tv.append(new String(ch, start, length));
id = false;
}
if (myName) {
tv.append(new String(ch, start, length));
myName = false;
}
System.out.println(tv.getText());
}
};
saxParser.parse(XML_FILE_URL, handler);
</Code>
--
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