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

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


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.


To do this you can use the following code:

using(XmlStateReader xr = new XmlStateReader(XmlReader.Create(@"C:\path-to-file.xml"))){    var fmtr = new XmlIts1Formatter();    fmtr.ValidateConformance = false;    fmtr.GraphAides.Add(new ClinicalDocumentDatatypeFormatter());    var parseResult = fmtr.Parse(xr, typeof(ClinicalDocument));    // There is a variable called structure which will contain your    var cda = parseResult.Structure as ClinicalDocument;} 

Not sure if that will help you transform, but that will read a CDA into a ClinicalDocument class.


You will need to create an XSLT that can be used to apply a transformation of the CDA to output the HTML you require