Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JAXB 2.0 Question?

Reply
Thread Tools

JAXB 2.0 Question?

 
 
Z
Guest
Posts: n/a
 
      03-09-2008
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
 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      03-09-2008
Z wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JAXB generates incorrect xml content!!! Marcello Marangio Java 4 10-23-2003 03:04 PM
JAXB creating Nested Interface from XSD Definition Brett Selleck Java 0 09-03-2003 07:16 PM
XML to java using JAXB ? Petterson Mikael Java 0 09-02-2003 01:50 PM
JAXB and Arabic encoding Brahim Machkour Java 3 07-27-2003 03:21 AM
JAXB, XSLT comparison Sony Antony Java 1 07-18-2003 05:57 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57