title: How to extract byte-array from one xml and store it in another in Java
body: <p>So I am using  DocumentBuilderFactory and DocumentBuilder to parse an xml.
  So it is DOM parser.</p>
  
  <p>But what I am trying to do is extract byte-array data (its an image encoded in base64)</p>
  
  <p>Store it in one object and later in code write it out to another xml encoded in base64.</p>
  
  <p>What is the best way to store this in btw.
  Store it as string? or as ByteArray?</p>
  
  <p>How can I extract byte array data in best way and write it out.</p>
  
  <p>I am not experienced with this so wanted to get opinion from the group.</p>
  
  <p>UPDATE: I am given XML I do not have control of incoming XML that comes in binary64 encoded </p>
  
  <pre><code>&lt; byte-array &gt;
    ... base64 encoded image ...
  &lt; /byte-array &gt;
  </code></pre>
  
  <p>Using parser I have I need to store this node and question is should that be byte or string 
  and then writing it out to another node in new xml. again in base64 encoding.</p>
  
  <p>thanks</p>