title: Convert xml to JSON in java servlet
body: <p>I have to call a perl script from a java servlet which returns an xml file. Then the java servlet converts the xml to json using jdom.
   So far, I've been successful in getting the xml. I tried a lot in vain to create the json using jdom. Any help will be appreciated.</p>
  
  <p>The XML file looks somewhat like this.</p>
  
  <pre><code>&lt;rsp stat="ok"&gt;
  &lt;results total="5"&gt;
  &lt;result cover="http://xxxxxxxxxxxxxxxxxxxxxx.jpg" title="aaaaa" year="dddd" director="qqqqqq" rating="yyy" details="666666"/&gt;
  &lt;/results&gt;
  &lt;/rsp&gt;
  </code></pre>
  
  <p>There are 5 such result rows.</p>