Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Why is JAXB namespace of my xml set to default ns1?</p> </blockquote> <p><code>ns1</code> is not the namespace but the prefix. The prefix is not significant. For example the following documents are all equivalent. The <code>foo</code> element is in the <code>FOO</code> namespace, and the <code>bar</code> element is in the <code>BAR</code> namespace.</p> <pre class="lang-xml prettyprint-override"><code>&lt;a:foo xmlns:a="FOO" xmlns:b="BAR&gt; &lt;b:bar&gt;Hello World&lt;/b:bar&gt; &lt;/a:foo&gt; </code></pre> <pre class="lang-xml prettyprint-override"><code>&lt;ns1:foo xmlns:ns1="FOO" xmlns:ns2="BAR&gt; &lt;ns2:bar&gt;Hello World&lt;/ns2:bar&gt; &lt;/ns1:foo&gt; </code></pre> <pre class="lang-xml prettyprint-override"><code>&lt;foo xmlns="FOO" xmlns:b="BAR&gt; &lt;b:bar&gt;Hello World&lt;/b:bar&gt; &lt;/foo&gt; </code></pre> <hr> <blockquote> <p>What am I doing wrong?</p> </blockquote> <p>Nothing. A <a href="http://jcp.org/en/jsr/detail?id=222" rel="noreferrer"><strong>JAXB (JSR-222)</strong></a> implementation is not required to use the prefix specified in the <code>@XmlSchema</code> annotation. <a href="http://www.eclipse.org/eclipselink/moxy.php" rel="noreferrer"><strong>EclipseLink JAXB (MOXy)</strong></a> does and recent versions of the JAXB RI appear to. The version/implementation of JAXB in NetBeans 7.2 appears to, while the version/implementation of JAXB that GlassFish 3.1.2 uses does not.</p> <p>Below is a link to an article that I wrote that goes into a little more detail and covers the <code>NamespacePrefixMapper</code> extension that may be useful here.</p> <ul> <li><a href="http://blog.bdoughan.com/2011/11/jaxb-and-namespace-prefixes.html" rel="noreferrer">http://blog.bdoughan.com/2011/11/jaxb-and-namespace-prefixes.html</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload