Je suis nouveau dans le domaine de la santé hl7 et j'ai reçu une tâche de sérialisation et de désérialisation du fichier CCD.xml.J'ai généré avec succès la classe ClinicalDocument à partir du fichier de schéma CDA.xsd en utilisant xda.exe tool.But comme je l'ai essayé quelque chose commeDésérialisation du fichier HL7 CCD.xml en objet de classe ClinicalDocument
XmlSerializer superCereal = new XmlSerializer(typeof(POCD_MT000040ClinicalDocument), xRoot);
StreamReader sr = new StreamReader(path);
POCD_MT000040ClinicalDocument doc = (POCD_MT000040ClinicalDocument)superCereal.Deserialize(sr);
sr.Close();
il donne une erreur comme "il y a une erreur dans le document XML (4, 2)." "ClinicalDocument xmlns = 'urn: hl7-org: v3' n'était pas prévu."
Voici ma classe ClinicalDocument qui est générée à l'aide xsd.exe outil
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;
}
}
}
s'il vous plaît aider Merci à l'avance
Impossible de dupliquer [{" n'était pas prévu.} Deserializing Twitter XML] (http://stackoverflow.com/questions/1556874/user-xmlns-was-not-expected-deserializing-twitter- xml) –
ardila
@ardila merci pour la réponse rapide, mais le fichier xml a déjà un élément racine. Ainsi, –