Get xml content



Here is my code while trying to read an xml file in my project This works great on my local computer, But after compiling it and put it on my android device, the xml file content is not showing



@Override
protected void postMain(Form f) {
String xmltxt="";
String code="";
try {
BufferedInputStream file=new BufferedInputStream(FileSystemStorage.getInstance().openInputStream("codes.xml"));
InputStreamReader reader=new InputStreamReader(file);

XMLParser parser=new XMLParser();
Element elt;
elt=parser.parse(reader);
int n=elt.getNumChildren();
for(int i=0; i<n; i++){
xmltxt=elt.getChildAt(i).getChildAt(0).getChildAt(0).getText();
code=elt.getChildAt(i).getChildAt(1).getChildAt(0).getText();
//Label label=new Label(code);

findList().addItem(xmltxt+": "+code);
}

} catch (IOException ex) {
System.out.println(ex.getMessage());
//Logger.getLogger(StateMachine.class.getName()).log(Level.SEVERE, null, ex);
}

}


Any idea? please


No comments:

Post a Comment