tags:

views:

14

answers:

0

Hi,

I am building a test output for DOM parser with node "Rider" and within that 7 attributes are there.URL://http://ps700.pranasystems.com/tours/8/xml/results/stage1results.xml. I want to display only the "name" and the "team" attributes output in the listview mode of the device.I am not getting clear where to store the output to display.

Please help me someone for how to store and display that data to the output of the device in List view.

Thanks in advance

//-------------------------------// Here is my code------------//

public String getSearch(String strURL) {

    URL url;
    URLConnection urlConn = null;
    NamedNodeMap  nnm = null;
    int  len;

    try {
    url = new URL(strURL);
    urlConn = url.openConnection();
    } catch (IOException ioe) {

        Log.e("Could not Connect: "+ioe.getMessage(), ".");
   } 
    DocumentBuilder builder = null ;
    Document doc = null ;

    try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(urlConn.getInputStream());

            Node thisNode, currentNode, node,theAttribute ; 
            NodeList nchild, nodeList; 
            String name;
            ArrayList<Node> result = new ArrayList<Node>();

            nodeList = doc.getElementsByTagName("rider"); 
       int length = nodeList.getLength();
       for (int i = 0; i < length; i++)
       { 
           currentNode = nodeList.item(i);
               NamedNodeMap attributes = currentNode.getAttributes();
               Log.i("TAG", attributes.toString());
               for (int a = 0; a < attributes.getLength(); a++) {
                theAttribute = attributes.item(a);
             }

              // s1.setAdapter(new ArrayAdapter<Node>(this,
              // android.R.layout.simple_list_item_1,result)); 

             }catch(ParserConfigurationException pce ){
              Log.e("Could not Parse XML:" +pce.getMessage() ,".");
        }
            catch (SAXException se)
            {Log.e("Could not Parse XML: "+se.getMessage(), ".");}
            catch (IOException ioe) {Log.e("Invalid XML: "+ioe.getMessage(), ".");}

    return strURL;

}