title: getting the value from xml feed in android
body: <p>I have developing one android application.</p>
  
  <p>i have passing the xml tags.</p>
  
  <p>Here i have facing some problems.please give me a solution for these .</p>
  
  <p>These is my xml feed :</p>
  
  <pre><code>   &lt;root&gt;
      &lt;Categories&gt;
      &lt;Category title="books" categoryid="1" image="http://google.com/dsdsds.png" &gt;
      &lt;SubCategory&gt;
       &lt;Subcategory name="Android" subcategoryid="2" subimage="http://google.comdsdsdsd.jpg" &gt;
      &lt;Products&gt;
      &lt;product name="android programming" productid="3" &gt;
         &lt;Retailers&gt;
        &lt;Retailer name='sfsdsds' /&gt;
         &lt;Retailer name='sdsdsdsd' /&gt;
          &lt;/Retailers&gt;
  </code></pre>
  
  <p>Here i have passing the retailer uisng the below code:</p>
  
  <pre><code>    if (productNode
                                                              .hasChildNodes()) {
                                                            NodeList retailerNameNL = productElmt
                                                                  .getElementsByTagName("Retailers");
                                                                  if (retailerNameNL.getLength() &gt; 0) {
                                                                      for (int rnCnt = 0; rnCnt &lt; retailerNameNL
                                                                              .getLength(); rnCnt++) {
                                                                          Node retailerNameNode = retailerNameNL
                                                                                  .item(rnCnt);
                                                                      if (retailerNameNode.hasChildNodes()) {
                                                                          Element retailernamesElmt = (Element) retailerNameNode;
                                                                          NodeList retailernamesChildNL = retailernamesElmt
                                                                                  .getElementsByTagName("Retailer");
                                                                          if (retailernamesChildNL.getLength() &gt; 0) {
                                                                              RetailerNameAL = new ArrayList&lt;RetailerNames&gt;();
                                                                              for (int rnIdx = 0; rnIdx &lt; retailernamesChildNL
                                                                                      .getLength(); rnIdx++) {
                                                                                  Node retailernamesChildNode = retailernamesChildNL
                                                                                          .item(rnIdx);
                                                                                  RetailerNames retailernamesBean = null;
                                                                                  Element retailernamesChildElmt = null;
                                                                                  if (retailernamesChildNode
                                                                                          .hasAttributes()) {
                                                                                      retailernamesBean = new RetailerNames();
                                                                                      retailernamesChildElmt = (Element) retailernamesChildNode;
                                                                                      retailernamesBean
                                                                                              .setmProductType(retailernamesChildElmt
                                                                                                      .getAttribute("name"));
                                                                              RetailerNameAL
                                                                                  .add(retailernamesBean);
  </code></pre>
  
  <p>Here i am getting the list of retailer names depends upon selected productid.</p>
  
  <p><strong>my query is :</strong></p>
  
  <p>i have to pass these list of name to another one activity depends upon the productid.</p>
  
  <pre><code>        List&lt;String&gt; shoplist = new ArrayList&lt;String&gt;();
                      shoplist.add(product.getString(TAG_SHOP));
                      shoplist.addAll(HomePage.retailerNameBean
                              .getmProductType()
                              + ",");
  
       ArrayAdapter&lt;String&gt; shopadapter = new ArrayAdapter&lt;String&gt;(EditWatchListProducts.this,
                                            android.R.layout.simple_spinner_item, shoplist);
  </code></pre>
  
  <p>But am getting the first item correctly.afterthat am getting the empty item on that list:</p>
  
  <p>pls give me the solution for these ... how can i get the Retailername list on that arraylist depands upon seletcted category.</p>