title: JAXB (un)marshalling of xsd types: xsd:base64Binary and xsd:hexBinary
body: <p>JAXB maps both <code>xsd:base64Binary</code> and <code>xsd:hexBinary</code> types to <code>byte[]</code>. <br></p>
  
  <p>Given that I have a schema/a DOM Element representing each of these types such as: </p>
  
  <p><code>&lt;foo&gt;ABCD&lt;/foo&gt;</code> for xsd:hexBinary and <br>
  <code>&lt;foo&gt;YTM0NZomIzI2OTsmIzM0NTueYQ==&lt;/foo&gt;</code> for xsd:base64Binary , </p>
  
  <p>it's not clear how JAXB 2.1 handles it.</p>
  
  <p><code>JAXB.unmarshal(new DOMSource(node), byte[].class)</code> does not like the payload.
  <br>Neither does the following:</p>
  
  <p><code>JAXBContext ctx = JAXBContext.newInstance(byte[].class);
   ctx.createUnmarshaller().unmarshal(node);</code></p>
  
  <p>What's the correct way of handling these types?
  Thanks in advance.</p>