XPATH评估结果为空目标节点

时间:2017-01-04 15:05:15

标签: java jaxb2

我有以下简单的XML Schema ...

<xs:complexType name="GenericType">
        <xs:annotation>
            <xs:appinfo>ContextBean</xs:appinfo>
            <xs:appinfo>ModifValidac</xs:appinfo>
        </xs:annotation>
        <xs:sequence>
            <xs:element minOccurs="0" name="country" type="TDCs:COUNTRY_Type"/>
            <xs:element minOccurs="0" name="finalDate" type="TDCs:GENERIC_DATE_Type"/>
        </xs:sequence>
    </xs:complexType>

我想对该字段进行注释&#34; finalDate&#34;用@jsonIgnore。

<jaxb:bindings version="2.1"
   xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
   xmlns:annox="http://annox.dev.java.net" jaxb:extensionBindingPrefixes="annox">

<jaxb:bindings node="xs:complexType[@name='GenericType']/xs:sequence/xs:element[@name='finalDate']">
       <annox:annotate target="field">
             <annox:annotate annox:class="com.fasterxml.jackson.annotation.JsonIgnore"/>
       </annox:annotate>  
</jaxb:bindings>

</jaxb:bindings>

但是当我运行命令时

mvn jaxb2:generate

我收到以下错误。

XPath evaluation of "xs:complexType[@name='GenericType']/xs:sequence/xs:element[@name='finalDate']" results in empty target node

有人可以帮助您在不修改原始XSD的情况下如何实现这一目标吗?

0 个答案:

没有答案