What happened to JAXB's NamespacePrefixMapper in JDK6u18

后端 未结 7 970
粉色の甜心
粉色の甜心 2020-12-08 19:44

I\'ve been using com.sun.xml.bind.marshaller.NamespacePrefixMapper in my project, and i had no problem with it in JDK 6u17. Now I just updated to 6u18, and I sa

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 20:25

    The NamespacePrefixMapper is not usable anymore.

    Use the annotations in package-info.java:

    @javax.xml.bind.annotation.XmlSchema(namespace = "http://nameSpaceUri"
    , xmlns = {
        @XmlNs(prefix = "myPrefix", namespaceURI = "http://nameSpaceUri")
    }
    , elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
    
    package my.package.;
    

    This works with the JAXB bundled with JDK7, for other JDK version update JAXB to 2.2.4.

提交回复
热议问题