title: How to read xml string values using this path as shown in code(getFilesDir().getAbsolutePath()+ File.separator + "test.xml")
body: <p>Hi Everybody,</p>
  
  <p>I am new to Android. I am using DOM parsing for reading xml string value. For that, I used following code, that code will work up to getting root element value after that it is giving exception please solve this problem,</p>
  
  <p>Advance Thanks,</p>
  
  <h2>Xml Code:</h2>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' standalone='yes' ?&gt;
  &lt;ChangePassword&gt;
    &lt;Oldpassword&gt;23545565635354&lt;/Oldpassword&gt;
    &lt;Newpassword&gt;addsffggfdsfdsfdfs &lt;/Newpassword&gt;
  &lt;/ChangePassword&gt;
  </code></pre>
  
  <h2>java code:</h2>
  
  <pre><code>   File file = new File(getFilesDir().getAbsolutePath()+ File.separator + "test.xml"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                        DocumentBuilder db = dbf.newDocumentBuilder();
                        Document doc = db.parse(file);
                        doc.getDocumentElement().normalize();
                        System.out.println("Root element " + doc.getDocumentElement().getNodeName());
                        NodeList nodeLst = doc.getElementsByTagName("ChangePassword");
                        System.out.println("Information of all entries");
  
                        for (int s = 0; s &lt; nodeLst.getLength(); s++) {
  
                          Node fstNode = nodeLst.item(s); 
  
                          if (fstNode.getNodeType() == Node.ELEMENT_NODE)
                          {
                            Element fstElmnt = (Element) fstNode;
  
                            // Firstname
                            NodeList fstNmElmntLst = ((Document) fstElmnt).getElementsByTagName("Oldpassword");
                            Element fstNmElmnt = (Element) fstNmElmntLst.item(0);
                            NodeList fstNm = ((Node) fstNmElmnt).getChildNodes();
                            System.out.println("Old password : "  + ((Node) fstNm.item(0)).getNodeValue());
  
                            // Lastname
                            NodeList lstNmElmntLst = ((Document) fstElmnt).getElementsByTagName("Newpassword");
                            Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
                            NodeList lstNm = ((Node) lstNmElmnt).getChildNodes();
                            System.out.println("Old password : " + ((Node) lstNm.item(0)).getNodeValue());
  
                            // Address
                            NodeList addrNmElmntLst = ((Document) fstElmnt).getElementsByTagName("Newpassword");
                            Element addrNmElmnt = (Element) addrNmElmntLst.item(0);
                            NodeList addrNm = ((Node) addrNmElmnt).getChildNodes();
                            System.out.println("Address : " + ((Node) addrNm.item(0)).getNodeValue());
                          }
                        }
                    } catch (Exception e) {
                        Log.e("Exception",e.toString());
                      //e.printStackTrace();
                    }
  </code></pre>