title: How do I use JAXB's @XmlSchema annotation on a Scala package object?
body: <p>This question is following on from <strong>Blaise</strong>'s <a href="https://stackoverflow.com/questions/3289644/define-spring-jaxb-namespaces-without-using-namespaceprefixmapper">excellent answer here</a>.</p>
  
  <p>My question is, how do I use the JAXB <code>@XmlSchema</code> annotation from within Scala?</p>
  
  <p>This is what I've come up with so far:</p>
  
  <pre><code>// File src/main/scala/co/orderly/prestasac/representations/wrappers.scala
  package co.orderly.prestasac.representations
  
  // JAXB
  import javax.xml.bind.annotation._
  
  @XmlSchema(xmlns = Array(@XmlNs(prefix = "xlink", namespaceURI = "http://www.w3.org/1999/xlink")))
  package object wrappers {
  }
  </code></pre>
  
  <p>Unfortunately this throws an error:</p>
  
  <pre><code>/home/alex/Development/Orderly/prestashop-scala-client/src/main/scala/co/orderly/prestasac/representations/wrappers/wrappers.scala:18: illegal start of simple expression
  [error] @XmlSchema(xmlns=Array(@XmlNs(prefix = "xlink", namespaceURI = "http://www.w3.org/1999/xlink")))
  [error]                        ^    
  </code></pre>
  
  <p>In case there's a workaround which doesn't require <code>@XmlSchema</code>, I'll explain what I'm trying to do - basically I'm trying to unmarshall an XML representation which looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;prestashop xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
  &lt;products&gt;
  &lt;product id="11" xlink:href="http://www.myshop.com/api/products/11"/&gt;
  &lt;product id="12" xlink:href="http://www.myshop.com/api/products/12"/&gt;
  ...
  &lt;/products&gt;
  &lt;/prestashop&gt;
  </code></pre>
  
  <p>I believe I need to use <code>@XmlSchema</code> to define the "xlink"-prefixed namespace for the <code>href</code> links...</p>