Java xml binding with wrong xmlns attribute name

Posted by Tom Brito on Stack Overflow See other posts from Stack Overflow or by Tom Brito
Published on 2010-05-20T15:32:00Z Indexed on 2010/05/20 16:10 UTC
Read the original article Hit count: 161

Filed under:
|

When I use the annotation:

@XmlRootElement(name="RootElement", namespace="namespace")
class RootElement {

to create xml file from java, it creates the root element as:

<ns2:RootElement xmlns:ns2="namespace">

but I wanted to create without the "ns2", like:

<RootElement xmlns="namespace">

Any idea how to fix it?

Reletad link (example I used to create the xml): http://www.java2s.com/Code/JavaAPI/javax.xml.bind.annotation/XmlRootElementname.htm

© Stack Overflow or respective owner

Related posts about java

Related posts about jaxb