Я использую следующий код, чтобы сделать демаршаллинг:маршалом объект в XML и удалить XMLNS
@Override
public String marshal(Object document) throws JAXBException {
Class clazz = document.getClass();
JAXBContext context =
JAXBContext.newInstance(clazz.getPackage().getName());
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
StringWriter sw = new StringWriter();
marshaller.marshal(document, sw);
String xml = sw.toString();
return xml;
}
Результат таков:
<IlpQuoteInput QuoteId="2888284000185" xmlns="http://www.abc.com">
<Common IlpSellerId="0001">
<Quotation QuotationDt="20130711"/>
<Product CurrencyCd="E">
etc etc
Это все хорошо, но я на самом деле не хочу чтобы иметь xmlns в выходе, что мне делать? Спасибо PS Я использую последнюю версию JAXB и Java 6.