JAXB 2.0 Question?

Z

Z

Hi,

I have created Java classes from an XSD using IntelliJ 6 and JAXB 2.0
plugin. I have populated the object and when I try to marshal the
object, I am getting ns2 appended to my root (default) element. I have
added a XmlRootElement tag to my root element. For the sake of
simplicity, I tried to unmarshal an XML file and then marshal it again
(without doing anything in between) as seen next:

My original XML file looks like the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><MSG
xmlns="http://xxx.yyy.com/"><ACKNOWLEDGEMENT>Success</
ACKNOWLEDGEMENT></MSG>

When I unmarshal it and marshal it again (doing nothing in between), I
get:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><MSG
xmlns:ns2="http://xxx.yyy.com/"><ns2:ACKNOWLEDGEMENT>Success</
ns2:ACKNOWLEDGEMENT></MSG>

I have used the same techniques before and they worked successfully. I
do not think the problem is with the XSD. Could you please tell me why
am I getting ns2 appended to my root element? and how can I get rid of
it?

Thanks in advance
 
A

Arne Vajhøj

Z said:
I have created Java classes from an XSD using IntelliJ 6 and JAXB 2.0
plugin. I have populated the object and when I try to marshal the
object, I am getting ns2 appended to my root (default) element. I have
added a XmlRootElement tag to my root element. For the sake of
simplicity, I tried to unmarshal an XML file and then marshal it again
(without doing anything in between) as seen next:

My original XML file looks like the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><MSG
xmlns="http://xxx.yyy.com/"><ACKNOWLEDGEMENT>Success</
ACKNOWLEDGEMENT></MSG>

When I unmarshal it and marshal it again (doing nothing in between), I
get:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><MSG
xmlns:ns2="http://xxx.yyy.com/"><ns2:ACKNOWLEDGEMENT>Success</
ns2:ACKNOWLEDGEMENT></MSG>

I have used the same techniques before and they worked successfully. I
do not think the problem is with the XSD. Could you please tell me why
am I getting ns2 appended to my root element? and how can I get rid of
it?

It is a bug in the software.

The two XML's are not equivalent.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top