Announcement Announcement Module
Collapse
No announcement yet.
Unable to rename the xml namespace prefix using org.springframework.oxm.Marshaller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to rename the xml namespace prefix using org.springframework.oxm.Marshaller

    Is it possible to change the namespace prefix from ns2, ns3 to my define type value using org.springframework.oxm.Marshaller?

    For example would like to convert from this format
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns3:Envelope
    xmlns:ns2="http://test.com/message-envelope"
    xmlns:ns3="http://www.w3.org/2003/05/soap-envelope">
    <ns3:Header>
    <ns2:Timestamp>2011-06-20T16:19:30.355+08:00</ns2:Timestamp>
    <ns2:MessageId>TEST Mesage ID1</ns2:MessageId>
    </ns3:Header>
    </ns3:Envelope>

    to
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <env:Envelope
    xmlns:hdr="http://test.com/message-envelope"
    xmlns:env="http://www.w3.org/2003/05/soap-envelope">
    <env:Header>
    <hdr:Timestamp>2011-06-20T16:19:30.355+08:00</hdr:Timestamp>
    <hdr:MessageId>TEST Mesage ID1</hdr:MessageId>
    </env:Header>
    </env:Envelope>

    I try to make the change under package-info.java, but it doesn't take effect.
    @javax.xml.bind.annotation.XmlSchema(
    elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,
    xmlns = {
    @javax.xml.bind.annotation.XmlNs(prefix="env", namespaceURI="http://www.w3.org/2003/05/soap-envelope"),
    @javax.xml.bind.annotation.XmlNs(prefix="hdr", namespaceURI="http://test.com/message-envelope")
    }
    )

    can anybody help for this? Thanks.
Working...
X