将 HL7 CCD.xml 文件反序列化为本机 ClinicalDocument Class 对象

deserializing HL7 CCD.xml file to native ClinicalDocument Class object

我是 hl7 医疗保健领域的新手,被分配了序列化和反序列化的任务 CCD.xml file.i 已从 CDA.xsd 模式文件成功生成 ClinicalDocument class使用 xda.exe tool.But 因为我尝试了

XmlSerializer superCereal = new XmlSerializer(typeof(POCD_MT000040ClinicalDocument), xRoot);
StreamReader sr = new StreamReader(path);
POCD_MT000040ClinicalDocument doc = (POCD_MT000040ClinicalDocument)superCereal.Deserialize(sr);
sr.Close();

它给出了一个错误 "There is an error in XML document (4, 2)." "ClinicalDocument xmlns='urn:hl7-org:v3' was not expected."

这是我使用 xsd.exe 工具生成的 ClinicalDocument Class

using System.Xml.Serialization;


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(TypeName = "POCD_MT000040.ClinicalDocument", Namespace = "urn:hl7-org:v3")]
[System.Xml.Serialization.XmlRootAttribute("ClinicalDocument", Namespace = "urn:hl7-org:v3", IsNullable = false)]
public partial class POCD_MT000040ClinicalDocument
{

private CS[] realmCodeField;

private POCD_MT000040InfrastructureRoottypeId typeIdField;

private II[] templateIdField;

private II idField;

private CE codeField;

private ST titleField;

private TS effectiveTimeField;

private CE confidentialityCodeField;

private CS languageCodeField;

private II setIdField;

private INT versionNumberField;

private TS copyTimeField;

private POCD_MT000040RecordTarget[] recordTargetField;

private POCD_MT000040Author[] authorField;

private POCD_MT000040DataEnterer dataEntererField;

private POCD_MT000040Informant12[] informantField;

private POCD_MT000040Custodian custodianField;

private POCD_MT000040InformationRecipient[] informationRecipientField;

private POCD_MT000040LegalAuthenticator legalAuthenticatorField;

private POCD_MT000040Authenticator[] authenticatorField;

private POCD_MT000040Participant1[] participantField;

private POCD_MT000040InFulfillmentOf[] inFulfillmentOfField;

private POCD_MT000040DocumentationOf[] documentationOfField;

private POCD_MT000040RelatedDocument[] relatedDocumentField;

private POCD_MT000040Authorization[] authorizationField;

private POCD_MT000040Component1 componentOfField;

private POCD_MT000040Component2 componentField;

private string nullFlavorField;

private ActClinicalDocument classCodeField;

private bool classCodeFieldSpecified;

private string moodCodeField;

public POCD_MT000040ClinicalDocument()
{
    this.classCodeField = ActClinicalDocument.DOCCLIN;
    this.moodCodeField = "EVN";
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("realmCode")]
public CS[] realmCode
{
    get
    {
        return this.realmCodeField;
    }
    set
    {
        this.realmCodeField = value;
    }
}

/// <remarks/>
public POCD_MT000040InfrastructureRoottypeId typeId
{
    get
    {
        return this.typeIdField;
    }
    set
    {
        this.typeIdField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("templateId")]
public II[] templateId
{
    get
    {
        return this.templateIdField;
    }
    set
    {
        this.templateIdField = value;
    }
}

/// <remarks/>
public II id
{
    get
    {
        return this.idField;
    }
    set
    {
        this.idField = value;
    }
}

/// <remarks/>
public CE code
{
    get
    {
        return this.codeField;
    }
    set
    {
        this.codeField = value;
    }
}

/// <remarks/>
public ST title
{
    get
    {
        return this.titleField;
    }
    set
    {
        this.titleField = value;
    }
}

/// <remarks/>
public TS effectiveTime
{
    get
    {
        return this.effectiveTimeField;
    }
    set
    {
        this.effectiveTimeField = value;
    }
}

/// <remarks/>
public CE confidentialityCode
{
    get
    {
        return this.confidentialityCodeField;
    }
    set
    {
        this.confidentialityCodeField = value;
    }
}

/// <remarks/>
public CS languageCode
{
    get
    {
        return this.languageCodeField;
    }
    set
    {
        this.languageCodeField = value;
    }
}

/// <remarks/>
public II setId
{
    get
    {
        return this.setIdField;
    }
    set
    {
        this.setIdField = value;
    }
}

/// <remarks/>
public INT versionNumber
{
    get
    {
        return this.versionNumberField;
    }
    set
    {
        this.versionNumberField = value;
    }
}

/// <remarks/>
public TS copyTime
{
    get
    {
        return this.copyTimeField;
    }
    set
    {
        this.copyTimeField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("recordTarget")]
public POCD_MT000040RecordTarget[] recordTarget
{
    get
    {
        return this.recordTargetField;
    }
    set
    {
        this.recordTargetField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("author")]
public POCD_MT000040Author[] author
{
    get
    {
        return this.authorField;
    }
    set
    {
        this.authorField = value;
    }
}

/// <remarks/>
public POCD_MT000040DataEnterer dataEnterer
{
    get
    {
        return this.dataEntererField;
    }
    set
    {
        this.dataEntererField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("informant")]
public POCD_MT000040Informant12[] informant
{
    get
    {
        return this.informantField;
    }
    set
    {
        this.informantField = value;
    }
}

/// <remarks/>
public POCD_MT000040Custodian custodian
{
    get
    {
        return this.custodianField;
    }
    set
    {
        this.custodianField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("informationRecipient")]
public POCD_MT000040InformationRecipient[] informationRecipient
{
    get
    {
        return this.informationRecipientField;
    }
    set
    {
        this.informationRecipientField = value;
    }
}

/// <remarks/>
public POCD_MT000040LegalAuthenticator legalAuthenticator
{
    get
    {
        return this.legalAuthenticatorField;
    }
    set
    {
        this.legalAuthenticatorField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("authenticator")]
public POCD_MT000040Authenticator[] authenticator
{
    get
    {
        return this.authenticatorField;
    }
    set
    {
        this.authenticatorField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("participant")]
public POCD_MT000040Participant1[] participant
{
    get
    {
        return this.participantField;
    }
    set
    {
        this.participantField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("inFulfillmentOf")]
public POCD_MT000040InFulfillmentOf[] inFulfillmentOf
{
    get
    {
        return this.inFulfillmentOfField;
    }
    set
    {
        this.inFulfillmentOfField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("documentationOf")]
public POCD_MT000040DocumentationOf[] documentationOf
{
    get
    {
        return this.documentationOfField;
    }
    set
    {
        this.documentationOfField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("relatedDocument")]
public POCD_MT000040RelatedDocument[] relatedDocument
{
    get
    {
        return this.relatedDocumentField;
    }
    set
    {
        this.relatedDocumentField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("authorization")]
public POCD_MT000040Authorization[] authorization
{
    get
    {
        return this.authorizationField;
    }
    set
    {
        this.authorizationField = value;
    }
}

/// <remarks/>
public POCD_MT000040Component1 componentOf
{
    get
    {
        return this.componentOfField;
    }
    set
    {
        this.componentOfField = value;
    }
}

/// <remarks/>
public POCD_MT000040Component2 component
{
    get
    {
        return this.componentField;
    }
    set
    {
        this.componentField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string nullFlavor
{
    get
    {
        return this.nullFlavorField;
    }
    set
    {
        this.nullFlavorField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public ActClinicalDocument classCode
{
    get
    {
        return this.classCodeField;
    }
    set
    {
        this.classCodeField = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool classCodeSpecified
{
    get
    {
        return this.classCodeFieldSpecified;
    }
    set
    {
        this.classCodeFieldSpecified = value;
    }
}

/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string moodCode
{
    get
    {
        return this.moodCodeField;
    }
    set
    {
        this.moodCodeField = value;
    }
}
}

请帮忙 提前致谢

我通过删除 CCD 中的注释节点使其工作