如何从CCD模式生成类

时间:2013-02-19 14:31:23

标签: c# xsd

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

  1. this example复制整个架构,将其粘贴到记事本中并将其另存为xsd文件。

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

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

  4. 但我收到了这个错误。

    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 /?".

1 个答案:

答案 0 :(得分:1)

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

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

相关问题