2016-04-28 151 views
3

我想從xsd爲FHIR生成java代碼。FHIR JAXB XJC代碼生成

我從here下載的代碼生成模式,然後我跑:

xjc patient.xsd 

但我有以下異常:

parsing a schema... 
[ERROR] src-resolve: Cannot resolve the name 'Account' to a(n) 'type definition' component. 
    line 332 of file:/Users/gerard/Downloads/fhir-codegen-xsd/fhir-base.xsd 

[ERROR] src-resolve: Cannot resolve the name 'DetectedIssue' to a(n) 'type definition' component. 
    line 354 of file:/Users/gerard/Downloads/fhir-codegen-xsd/fhir-base.xsd 

[ERROR] src-resolve: Cannot resolve the name 'ImplementationGuide' to a(n) 'type definition' component. 
    line 380 of file:/Users/gerard/Downloads/fhir-codegen-xsd/fhir-base.xsd 

[ERROR] src-resolve: Cannot resolve the name 'MedicationOrder' to a(n) 'type definition' component. 
    line 387 of file:/Users/gerard/Downloads/fhir-codegen-xsd/fhir-base.xsd 

[ERROR] src-resolve: Cannot resolve the name 'QuestionnaireResponse' to a(n) 'type definition' component. 
    line 409 of file:/Users/gerard/Downloads/fhir-codegen-xsd/fhir-base.xsd 

[ERROR] src-resolve: Cannot resolve the name 'Parameters' to a(n) 'type definition' component. 
    line 425 of file:/Users/gerard/Downloads/fhir-codegen-xsd/fhir-base.xsd 

[ERROR] src-resolve: Cannot resolve the name 'MeasuredQuantity' to a(n) 'type definition' component. 
    line 225 of file:/Users/gerard/Downloads/fhir-codegen-xsd/questionnaireanswers.xsd 

我已經導入到Eclipse中的所有的XSD和我在fhir-base.xsd中看到相同的錯誤。不知道如何解決它,因爲例如account.xsd在同一個目錄中。

+0

在這裏發佈相關的xsd文件可能會有所幫助(即patient.xsd和fhir-base.xsd) – rmlan

+0

@rmlan文件很大,您可以從「here」鏈接下載它。謝謝。 – gerardribas

回答

0

有一個名爲fhir-all.xsd的單獨模式。當一切都在一個文件中時,代碼生成器往往更快樂,所以我們爲此目的發佈了這個模式。

1

我遇到了同樣的問題。我已經試過三種資源從所提供的fhir網站上的歸檔:

fhir-base.xsd 
fhir-all.xsd 
fhir-single.xsd 

每個錯誤似乎採取同樣的形式對fhir-base.xsd(這些條目73)...

[ERROR] Property "Lang" is already defined. Use <jaxb:property> to resolve this conflict. 
    line 323 of file:/E:/fhir-spec/resources/fhir-all-xsd/fhir-xhtml.xsd 

[ERROR] The following location is relevant to the above error 
    line 324 of file:/E:/fhir-spec/resources/fhir-all-xsd/fhir-xhtml.xsd 

只是想一些蠻力戰術。我發現註釋掉在fhir-xhtml.xsd幾行:

Lines 323, 324 
<xs:attribute name="lang" type="LanguageCode"/> 
<xs:attribute ref="xml:lang"/> 

Line 1351 
<xs:attribute name="lang" type="LanguageCode"/> 

這我能夠成功生成代碼後。

mkdir gen 
xjc -d gen fhir-base.xsd 

我找不到任何地方「官方」,例如github等文件的問題。我並不確定xhtml開始的意圖,但我想知道這裏可能發生的是fhir數據類型'LanguageCode'和語言代碼的html規範之間的衝突嗎?

祝你好運!

相關問題