title: XML to Java with JAXB unmarshalling
body: <p>I'm using the below code to unmarshal an XML to a set of Java classes (classes generated from an xsd).</p>
  
  <pre><code>JAXBContext jc = JAXBContext.newInstance(BlockType.class);
  StreamSource xml = new StreamSource("C:\\Users\\Se\\Desktop\\watch2.xml");
  Unmarshaller unmarshaller = jc.createUnmarshaller();
  JAXBElement&lt;BlockType&gt; je1 = unmarshaller.unmarshal(xml, BlockType.class);
  
  BlockType cgwt = je1.getValue();
  </code></pre>
  
  <p>The XML that has to be unmarshalled has at its beginning a line like this one:</p>
  
  <pre><code>&lt;test:MessageBlock xsi:schemaLocation="http://www.test.com/Watch/v2.1 Test_WatchSchema_v2.1.xsd"&gt;
  </code></pre>
  
  <p>If I remove the test: and xsi:.... the XML gets unmarshalled correctly. However, if I let them I get </p>
  
  <pre><code>[org.xml.sax.SAXParseException: The prefix "test" for element "test:CargoWatchMessageBlock" is not bound.]
  </code></pre>
  
  <p>How can I fix this ?</p>