title: Getting data from XML in android studio
body: <p>My aim is to access the xml file and get the No present inside the xml file.
  I want access data from my xml which is in local storage but i am not able to access the values getting errors at xpath.Kindly help me</p>
  
  <p>xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Sample&gt;
  &lt;Sample1&gt;
      &lt;NO&gt;257&lt;/LastPage&gt;
  &lt;/sample1&gt;
  &lt;Sample2&gt;
      &lt;NO&gt;257&lt;/LastPage&gt;
  &lt;/sample2&gt;
  &lt;/Sample&gt;
  </code></pre>
  
  <p>Class File:</p>
  
  <pre><code>AssetManager manager = getAssets();
          InputStream inputStream = manager.open("PageDetails.xml");
          DocumentBuilderFactory builderFactory = 
   DocumentBuilderFactory.newInstance();
          DocumentBuilder builder =  builderFactory.newDocumentBuilder();
          Document xmlDocument = builder.parse(inputStream);
  
          XPath xPath =  XPathFactory.newInstance().newXPath();
          String expression = "/Bhajans/"+bookPath;
          Node lastpageNO = (Node) xPath.evaluate(expression, xmlDocument,  
   XPathConstants.NODE);
          Log.d("Displaying page No:","number"+lastpageNO);
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>06-06 12:10:04.119  30072-30072/com.com.sample.samples W/System.err﹕ javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: Extra illegal tokens: '5'
  06-06 12:10:04.119  30072-30072/com.com.sample.samples W/System.err﹕ at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:295)
  </code></pre>