Configuration config = new Configuration();
Map<String, String> xmlToJsonNamespaces = new HashMap<String,String>(1);
xmlToJsonNamespaces.put("http://www.example.org/b/Test", "test");
xmlToJsonNamespaces.put("http://www.example.org/a/TestCanonical", "can");
config.setXmlToJsonNamespaces(xmlToJsonNamespaces);
MappedNamespaceConvention con = new MappedNamespaceConvention(config);
StringWriter writer = new StringWriter();
XMLStreamWriter xmlStreamWriter = new MappedXMLStreamWriter(con, writer);
Marshaller marshaller = jc.createMarshaller();
marshaller.marshal(JAXBXmlTypeProvider.wrapInJAXBElement(result, TestExtends.class), xmlStreamWriter);