I'm trying to move from the JAXB reference implementation to EclipseLink JAXB (MOXy) because it appears to solve JAXB outputting invalid XML when data contains non-displayable chars but I have a problem with it displaying namespace tags.
This is how I create a JAXBContext
return JAXBContext.newInstance("org.musicbrainz.mmd2");
and this is the output I get
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<metadata created="2013-02-27T12:12:13.305Z"
xmlns="http://musicbrainz.org/ns/mmd-2.0#"
xmlns:ext="http://musicbrainz.org/ns/ext#-2.0">
<annotation-list count="1" offset="0">
<annotation type="release" ext:score="100">
<entity>bdb24cb5-404b-4f60-bba4-7b730325ae47</entity>
<name>Pieds nus sur la braise</name>
<text>EAN: 0828768226629 - DiscID: TWj6cLku360MfFYAq_MEaT_stgc-</text>
</annotation>
</annotation-list>
</metadata>
I'm trying to get same output with EclipseLink MOXy, I get context as follows
Map<String, Object> properties = new HashMap<String, Object>(1);
properties.put(JAXBContextProperties.MEDIA_TYPE, "application/xml");
return JAXBContextFactory.createContext(new Class[]{Metadata.class}, properties);
and this generates
<?xml version="1.0" encoding="UTF-8"?>
<ns0:metadata
xmlns:ns0="http://musicbrainz.org/ns/mmd-2.0#"
xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"
created="2013-02-27T12:11:35.511Z">
<ns0:annotation-list count="1" offset="0">
<ns0:annotation type="release" ext:score="100">
<ns0:entity>bdb24cb5-404b-4f60-bba4-7b730325ae47</ns0:entity>
<ns0:name>Pieds nus sur la braise</ns0:name>
<ns0:text>EAN: 0828768226629 - DiscID: TWj6cLku360MfFYAq_MEaT_stgc-</ns0:text>
</ns0:annotation>
</ns0:annotation-list>
</ns0:metadata>
I don't want the ns0 stuff, can I get rid of it