[英]deserializing HL7 CCD.xml file to native ClinicalDocument Class object
i'm new to hl7 healthcare domain and was assigned a task of serializing and deserializing CCD.xml file.i have successfully generated the ClinicalDocument class from CDA.xsd schema file using xda.exe tool.But as i tried something like 我是hl7医疗保健领域的新手,并被分配了一个序列化和反序列化CCD.xml文件的任务。我已经使用xda.exe工具从CDA.xsd模式文件成功生成了ClinicalDocument类。但是我试过像
XmlSerializer superCereal = new XmlSerializer(typeof(POCD_MT000040ClinicalDocument), xRoot);
StreamReader sr = new StreamReader(path);
POCD_MT000040ClinicalDocument doc = (POCD_MT000040ClinicalDocument)superCereal.Deserialize(sr);
sr.Close();
it give an error like "There is an error in XML document (4, 2)." 它会给出一个错误,例如“XML文档中存在错误(4,2)”。 "ClinicalDocument xmlns='urn:hl7-org:v3' was not expected." “ClinicalDocument xmlns ='urn:hl7-org:v3'不是预期的。”
Here is my ClinicalDocument Class that is generated using xsd.exe tool 这是我使用xsd.exe工具生成的ClinicalDocument类
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;
}
}
}
please help Thanks in advance 请帮忙提前谢谢
我通过在CCD中删除注释节点来实现它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.