XPath评估“ // element [@ name ='startTime']”导致目标节点为空

时间:2018-10-24 13:54:02

标签: xjc xml-binding

我尝试了各种方法,但未能通过该问题。 VoIP3.5-A.0-short.xsd文件的内容

   <?xml version="1.0" encoding="UTF-8"?>
   <!--Generated by Turbo XML 2.4.1.100. Conforms to w3c 
    http://www.w3.org/2001/XMLSchema-->
   <schema xmlns="http://www.w3.org/2001/XMLSchema" 
       targetNamespace="http://www.ipdr.org/namespaces/VoIP">
        <element name="subscriberID" type="string"/>
        <element name="hostName" type="string"/>
        <element name="ipAddress" type="string"/>
        <element name="startTime" type="string"/>
        <element name="endTime" type="string"/>
        <element name="timeZoneOffset" type="integer"/>
        <element name="callCompletionCode" type="string"/>
        <element name="originalDestinationId" type="string"/>
    </schema>

绑定文件VoIP3.5-A.0.xjb

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings xmlns="http://www.w3.org/2001/XMLSchema"
       xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="1.0">
  <jaxb:bindings schemaLocation="VoIP3.5-A.0-short.xsd">
    <jaxb:bindings node="//element[@name='startTime']">
      <jaxb:class name="VoIPStartTime"/>
    </jaxb:bindings>
  </jaxb:bindings>
</jaxb:bindings>

环境: Java 1.8.0_181 xjc 2.2.8-b130911.1802

xjc -d tmp  -b .\VoIP3.5-A.0.xjb .\VoIP3.5-A.0-short.xsd
parsing a schema...
[ERROR] XPath evaluation of "//element[@name='startTime']" results in empty target node
  line 5 of file:/C:/DevWorkSpace/gs-correlator/src/main/resources/VoIP3.5-A.0.xjb

Failed to parse a schema.

0 个答案:

没有答案