Hi,
How to create a List with XMLParsed Data ... In XML one text tag Having 7 Attributes And I have to Display them in a List. Parsing is done By DOM.
private void DownloadLINK(String URL)
{
TextView display = new TextView(this);
InputStream in = null;
try {
in = OpenHttpConnection(URL);
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db;
try
{
db = dbf.newDocumentBuilder();
doc = db.parse(in);
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
doc.getDocumentElement().normalize();
NodeList itemNodes = doc.getElementsByTagName(outline);
String str="";
for (int i=0; i<itemNodes.getLength();i++)
{
Message message = new Message();
Node item = itemNodes.item(i);
NamedNodeMap namedNodeMap=item.getAttributes();
for(int k=0;k<namedNodeMap.getLength();k++)
{
Attr attr = (Attr)namedNodeMap.item(k);
String name=attr.getNodeName();
String value=attr.getNodeValue();
str+=name+":"+value+"\n";
display.setText(str);
}
}
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
// display.setText("Error: " + e.getMessage());
Log.e(MY_DEBUG_TAG, "111111111111111122222222223333333333333", e);
}
this.setContentView(display);
}
Kindly help me How can I Display List in onCreate Method...