我試圖讓hyperjaxb處理一個真正的模式。我下載並解壓縮了hyperjaxb maven項目from this link,然後使用cmd.exe
導航到根目錄,並通過運行mvn clean install
以確保它與示例模式一起使用示例數據對其進行測試。然後,我用一個精簡版的實際shematics替換schema.xsd
,po.xml
和bindings.xjb
文件,以便我可以準備通過上述鏈接的hyperjaxb項目運行真實應用程序。然後我再次運行mvn clean install
。從替換bindings.xjb
文件,您可以使用schema.xsd
文件at this link和po.xml
,你可以閱讀at this link閱讀at this link. 「xs:complexType [@ name ='Any']」的XPath評估會導致空的目標節點
[ERROR] Error while parsing schema(s).Location
[ file:/C:/path/to/src/main/resources/bindings.xjb{25,53}].
com.sun.istack.SAXParseException2; systemId:
file:/C:/path/to/src/main/resources/bindings.xjb; lineNumber: 25; columnNumber: 53;
XPath evaluation of "xs:complexType[@name='Any']" results in empty target node
:不過,我收到以下錯誤消息。
bindings.xjb的相關部分是:
<jaxb:bindings node="xs:complexType[@name='Any']">
<hj:entity>
<orm:table name="any"/>
</hj:entity>
</jaxb:bindings>
在schema.xsd的ANY
複雜類型的定義是:
<xs:complexType name="ANY"><!-- abstract="true">-->
<xs:annotation>
<xs:documentation>
Some documentation.
</xs:documentation>
</xs:annotation>
<xs:attribute name="nullFlavor" type="NullFlavor" use="optional">
<xs:annotation>
<xs:documentation>
Some other documentation.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
注意,完整的代碼在上面的鏈接。 我該如何解決這個錯誤?
非常感謝您對此進行調查。我剛剛嘗試了您的更改,但它導致了相同的確切錯誤。還有什麼可能導致這種情況? – CodeMed 2014-10-16 17:34:15
你可以添加更多的XSD細節嗎? – Xstian 2014-10-16 17:35:25
我發佈了整個xsd文件以及所有其他相關文件,以完全重現上面我原始發佈的鏈接中的問題。該xsd文件是259行,所以我不想污染整個發佈。但是有人可以在幾分鐘內使用上述所有鏈接在本地機器上重現問題。 – CodeMed 2014-10-16 17:37:12