Parse XML doc (Clinical Document Architecture-CDA,HL7 standard) using Everest Framework

后端 未结 3 1370
暗喜
暗喜 2021-02-07 22:07

I am trying to parse some clinical information from XML file that is standardized to HL7 V3 CDA standard .

Xml file :

 

        
3条回答
  •  鱼传尺愫
    2021-02-07 22:43

    I am assuming you're using visual studios. If so this is the easiest solution in my opinion: 1.Create a c# class. 2.Then Copy all of your XML (from one of your CDA's). 3.Then go to that class you created before and go to Edit>paste special>Paste XML as Classes.

    This will create a class for you based off that XML. Then all you have to do to parse any xml (CDA) like one you copied, is deserialize it into that class type and it will create an object which you can pull all the information out of. I hope that helps!

    EDIT: http://blog.codeinside.eu/2014/09/08/Visual-Studio-2013-Paste-Special-JSON-And-Xml/

    enter image description here

    Deserialize example: (presuming the class you created is called CDA)

    string path = "The Path of the XML file";
    
    XmlSerializer superCereal = new XmlSerializer(typeof(CDA));
    StreamReader sr = new StreamReader(path);
    CDA doc= (CDA)superCereal.Deserialize(sr);
    sr.Close();
    

    Now the object doc will have all the information of the xml inside of it.

提交回复
热议问题