title: xml parsing getting the element value null
body: <p>I have create a webservice looks like :</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8" standalone="yes" ?&gt; 
  - &lt;todoLists&gt;
  - &lt;todoList&gt;
    &lt;productId&gt;smthig&lt;/productId&gt; 
    &lt;siteCode&gt;smthing&lt;/siteCode&gt; 
    &lt;subDeptId&gt;smthing&lt;/subDeptId&gt; 
    &lt;/todoList&gt;
    &lt;/todoLists&gt;
  </code></pre>
  
  <p>and  i am trying to parse it using DOM parser using below code , i am getting  nodeList.getLength() = 20 but not getting the value of the elements .it is showing null i have also tried the SAX parser but that is also giving null. Is there anything wrong with the webservice ?? please suggest.</p>
  
  <pre><code>public class XMLParsingDOMExample extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          /** Create a new layout to display the view */
          LinearLayout layout = new LinearLayout(this);
          layout.setOrientation(1);
  
          /** Create a new textview array to display the results */
  
  
          TextView category[];
  
          try {
  
              URL url = new URL(
              "http://xxxxxx:8080/webservicedemo/rest/todo");
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              DocumentBuilder db = dbf.newDocumentBuilder();
              Document doc = db.parse(new InputSource(url.openStream()));
              doc.getDocumentElement().normalize();
  
              NodeList nodeList = doc.getElementsByTagName("todoList");
              System.out.println("null 1");
              /** Assign textview array lenght by arraylist size */
  
  
              category = new TextView[nodeList.getLength()];
              System.out.println("null 122 nodeList.getLength()" +nodeList.getLength());
              for (int i = 0; i &lt; nodeList.getLength(); i++) {
  
                  Node node = nodeList.item(i);
                  category[i] = new TextView(this);
                  Element fstElmnt = (Element) node;
                  category[i].setText("Name = "
                          + fstElmnt.getAttribute("siteCode"));
  
  
                  layout.addView(category[i]);
                  System.out.println("null 551");
  
              }
          } catch (Exception e) {
              System.out.println("XML Pasing Excpetion = " + e);
          }
  
          /** Set the layout view to display */
          setContentView(layout);
  
      }
  
  
      public class RSSAdapter extends BaseAdapter {
          Element rootElement;
  
          public RSSAdapter(Element rootElement) {
              this.rootElement = rootElement;
          }
  
          public int getCount() {
              // get the count of children of the root element
              return 0;
          }
  
          public Object getItem(int position) {
              // get the child identified by the position, 
              // this is the important part where you    
              // want to get the right child representing the RSS data that you want to get
              return null;
          }
  
          public long getItemId(int position) {
              return position;
          }
  
          public View getView(int position, View convertView, ViewGroup parent) {
              // implement your view here....
              return null;
          }
      }
  
  }
  </code></pre>