jaxb外部xml绑定文件:单个XSD的xjc javaType

时间:2019-01-15 21:39:22

标签: xml soap jaxb jax-ws

我试图为一个XSD而不是所有的XSD绑定

这是一个示例XML,其中显示了有效的“全局”绑定和不起作用的部分

我该如何解决?

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings version="2.0" 
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance">

    <!--this has no effect at all with or without the node-->
    <jaxb:bindings schemaLocation="myXsd.xsd"  node="/xs:schema">
        <!-- adding node here has no effect -->
        <bindings>
            <xjc:javaType adapter="com.MyDateAdapter" name="java.time.LocalDate" xmlType="xs:date" />
         </bindings>
    </jaxb:bindings>

    <!-- this works but I only want this binding for a single XSD not all XSD -->
    <!--
    <jaxb:globalBindings>
        <xjc:javaType adapter="com.MyDateAdapter" name="java.time.LocalDate" xmlType="xs:date" />
    </jaxb:globalBindings>
    --> 

</jaxb:bindings>

0 个答案:

没有答案