JAXB 2.0 Question?

Discussion in 'Java' started by Z, Mar 9, 2008.

  1. Z

    Z Guest

    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
    Z, Mar 9, 2008
    #1
    1. Advertising

  2. Z

    Arne Vajhøj Guest

    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
    Arne Vajhøj, Mar 9, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sony Antony

    JAXB, XSLT comparison

    Sony Antony, Jul 17, 2003, in forum: Java
    Replies:
    1
    Views:
    894
    Arto V. Viitanen
    Jul 18, 2003
  2. Brahim Machkour

    JAXB and Arabic encoding

    Brahim Machkour, Jul 25, 2003, in forum: Java
    Replies:
    3
    Views:
    559
    Jon A. Cruz
    Jul 27, 2003
  3. Petterson Mikael

    XML to java using JAXB ?

    Petterson Mikael, Sep 2, 2003, in forum: Java
    Replies:
    0
    Views:
    391
    Petterson Mikael
    Sep 2, 2003
  4. Brett Selleck
    Replies:
    0
    Views:
    777
    Brett Selleck
    Sep 3, 2003
  5. Marcello Marangio

    JAXB generates incorrect xml content!!!

    Marcello Marangio, Oct 22, 2003, in forum: Java
    Replies:
    4
    Views:
    2,041
    Simon
    Oct 23, 2003
Loading...

Share This Page