FHIR JAXB XJC代码生成



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

我从这里下载了代码生成模式,然后运行:

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规范之间的冲突吗?

祝你好运!

有一个单独的模式叫做fhir-all.xsd。当所有内容都在一个文件中时,代码生成器往往会更快乐,所以我们发布这个模式就是为了这个目的。

最新更新