How to marshal without a namespace?

前端 未结 7 473
野的像风
野的像风 2020-12-01 06:33

I have a fairly large repetitive XML to create using JAXB. Storing the whole object in the memory then do the marshaling takes too much memory. Essentially, my XML looks lik

相关标签:
7条回答
  • 2020-12-01 07:37

    For me, simply calling xmlStreamWriter.setDefaultNamespace("") solved the issue.

    One more thing you have to care in order to remove the namespace prefix from the output is that everywhere you have @XmlElement ensure it does not include the namespace property like @XmlElement(name="", namespace"http://..."); otherwise, none of solutions will work.

    0 讨论(0)
提交回复
热议问题