title: Read xml document using jsp
body: <p>I need to read the xml document contents and read the key value pair using the xpath</p>
  
  <p>document.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Disposition-Config&gt;
      &lt;LOB&gt;
          &lt;lob_pair key = "0" value = "N/A"/&gt;
      &lt;/LOB&gt;
      &lt;SourceCode&gt;
          &lt;sourcecode_pair key = "0" value = "N/A"/&gt;
      &lt;/SourceCode&gt;
      &lt;TerminationCode&gt;
          &lt;terminationcode_pair key = "0" value = "N/A"/&gt;
      &lt;/TerminationCode&gt;
  &lt;/Disposition-Config&gt;
  </code></pre>
  
  <p>jsp scriplet</p>
  
  <pre><code>&lt;%
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  
  try {
      out.println(request.getRealPath("/WEB-INF/disposition.xml"));
      Document doc = db.parse(new File(request.getRealPath("/WEB-INF/document.xml")));
      out.println(doc);
      String  lobExpression = "/Disposition-Config/LOB/lob_pair";
      String  sourceCodeExpression = "/Disposition-Config/SourceCode/sourcecode_pair";
      String  terminationCodeExpression = "/Disposition-Config/TerminationCode/terminationcode_pair";
      CMETabReader cmeTabReader = new CMETabReader();
      /* class to retrieve key value from xml */
      cmeTabReader.getDispositionValues(doc, lobExpression);
  } catch(Exception e) {
      out.print(e);
      e.printStackTrace();
  }
  
  %&gt;
  </code></pre>
  
  <p>but when i try to print the xml doc using</p>
  
  <pre><code>&lt;% out.println(doc) %&gt;
  </code></pre>
  
  <p>its prints like</p>
  
  <pre><code> [#document: null] 
  </code></pre>
  
  <p>Any suggestions???</p>