gpt4 book ai didi

java - FHIR JAXB XJC 代码生成

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:15:08 24 4
gpt4 key购买 nike

我正在尝试从用于 FHIR 的 xsd 生成 java 代码。

我从 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

我已经将所有 xsd 导入到 eclipse 中,我在 fhir-base.xsd 中看到了同样的错误。不确定如何解决它,因为例如 account.xsd 位于同一目录中。

最佳答案

我遇到了同样的问题。我尝试了 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 规范之间的冲突吗?

祝你好运!

关于java - FHIR JAXB XJC 代码生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36916060/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com