How do I replace HTML escapes in an input stream before parsing it to XML?
<p>I have an input stream which is being converted to XML, and read.  When I get down to some text elements in the XML, they are truncated. I believe the parser is dropping everything after escaped HTML such as &amp;  Here is the code getting the input stream and then getting the text element.</p>

<pre><code>String hvurl = "https://www.mysite.com/api/a/" + answerId;
in = OpenHttpConnection(hvurl); 

Document doc = null;
DocumentBuilderFactory dbf = 
    DocumentBuilderFactory.newInstance();
DocumentBuilder db;

try {
    db = dbf.newDocumentBuilder();
    doc = db.parse(in);

} catch (ParserConfigurationException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (SAXException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}     

...
//Now when I get the text element, it's truncated
//---get the &lt;varietalTitle&gt; elements under the &lt;varietal&gt; 
// element---
NodeList varietalTitleNodes = 
    (varietalElement).getElementsByTagName("varietaltitle");

//---convert a Node into an Element---
Element varietalTitleElement = (Element) varietalTitleNodes.item(0);

//---get all the child nodes under the &lt;varietaltitle&gt; element---
NodeList varietalTitleTextNodes = 
    ((Node) varietalTitleElement).getChildNodes();

//---retrieve the text of the &lt;varietalid&gt; element---
strVarietalTitle = ((Node) varietalTitleTextNodes.item(0)).getNodeValue();
</code></pre>
