繁体   English   中英

FHIR JAXB XJC代码生成

[英]FHIR JAXB XJC Code generation

我正在尝试从xsd为FHIR生成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

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

有一个名为fhir-all.xsd的独立模式。 当一切都在一个文件中时,代码生成器往往会更快乐,所以我们为此目的发布了这个模式。

我遇到了同样的问题。 我从fhir网站上提供的档案中尝试了三种资源:

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

每个错误似乎采取相同的形式(这些条目中的73个)对fhir-base.xsd ...

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

祝好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM