Read entire XML file and store in memory java
<p>Here is what I am trying to do.</p>

<ol>
<li>Read entire XML file (I do not care the name of element or attribute,etc..).</li>
<li>Save the read XML file into memory.</li>
<li>Update some values of read xml file.</li>
<li>Write back to a XML file.</li>
</ol>

<p>I am trying to use XMLStreamReader to read a XML file, however all the examples I see so far, it looks like i have to provide element name.  But, I do not care about element names, just want to read entier XML file into memory.  And, I am not sure how datatype I should be storing as I am reading.  I am thinking to store them into Document datatype.</p>

<p>Any suggestions on how to read entire XML file and store read contents in memeory?</p>

<p>Thanks.</p>
