如何从CCD模式生成类

本文关键字:模式 CCD | 更新日期: 2023-09-27 18:00:12

我尝试使用以下步骤生成CCD.xsd到C#类文件:

  1. 复制本例中的整个模式,将其粘贴在记事本中,并将其保存为xsd文件。

  2. 从命令提示符执行xsd命令xsd D:'ccd.xsd /c /n:CCD(以管理员身份运行)。

  3. ccd.cs类文件已成功创建,没有任何错误或警告。

但我犯了这个错误。

Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.17929]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'urn:hl7-org:sdtc:patient' element is not declare
d. Line 5902, position 8.
Schema validation warning: The 'urn:hl7-org:sdtc:patient' element is not declare
d. Line 4868, position 8.
Schema validation warning: The 'urn:hl7-org:sdtc:patient' element is not declare
d. Line 4852, position 8.
Warning: Schema could not be validated. Class generation may fail or may produce
 incorrect results.
Error: Error generating classes for schema 'ccd'.
  - The element 'urn:hl7-org:sdtc:patient' is missing.

如果需要更多帮助,请键入"xsd/?"。

如何从CCD模式生成类

要消除警告,您必须找到定义patient元素的SDTC XSD(targetNamespace='urn:hl7 org:SDTC')。除了ccd.xsd之外,还将新文件添加到xsd.exe命令行中(确保还列出了SDTC xsd需要的任何文件)。

需要将SDTC文件添加到命令行的原因与ccd.xsd没有显式导入SDTC命名空间有关。