java - How to read <text> node values from CCDA xml file using MDHT -


i using mdht parse xml values of ccda file. not able read value non-contributory form <text> <paragraph>non-contributory</paragraph></text>. consider following xml content : `


family history


  <component>     <section>       <!--  family history section template  -->       <templateid root="2.16.840.1.113883.10.20.22.2.15"/>       <code code="10157-6" displayname="family history" codesystem="2.16.840.1.113883.6.1" codesystemname="loinc"/>       <title>family history</title>       <text>         <paragraph>non-contributory</paragraph>       </text>     </section>   </component> 

`

any url or reference appreciated.

you not need parse text element. text elements in ccda document used make human readable format. same values present in entry elements of sections.

edit: following code may help

    package org.openhealthtools.mdht.uml.cda.consol.tests;  import java.io.fileinputstream; import java.util.stack;  import org.eclipse.emf.ecore.ereference; import org.eclipse.emf.ecore.util.featuremap; import org.eclipse.emf.ecore.util.featuremap.entry; import org.eclipse.emf.ecore.xml.type.anytype; import org.openhealthtools.mdht.uml.cda.clinicaldocument; import org.openhealthtools.mdht.uml.cda.strucdoctext; import org.openhealthtools.mdht.uml.cda.consol.allergiessection; import org.openhealthtools.mdht.uml.cda.consol.consolpackage; import org.openhealthtools.mdht.uml.cda.consol.continuityofcaredocument; import org.openhealthtools.mdht.uml.cda.util.cdautil; import org.openhealthtools.mdht.uml.cda.util.validationresult;  public class main {     public static void main(string[] args) throws exception {         consolpackage.einstance.eclass(); // static package registration          clinicaldocument clinicaldocument = cdautil.load(             new fileinputstream("samples/ccd.sample.xml"), (validationresult) null);         if (clinicaldocument instanceof continuityofcaredocument) {             continuityofcaredocument ccd = (continuityofcaredocument) clinicaldocument;              allergiessection allergiessection = ccd.getallergiessection();              strucdoctext text = allergiessection.gettext();             traverse(text.getmixed());         }      }      private static void traverse(featuremap root) {         stack<featuremap> stack = new stack<featuremap>();         stack.push(root);         while (!stack.isempty()) {             featuremap featuremap = stack.pop();             (int = featuremap.size() - 1; >= 0; i--) {                 entry entry = featuremap.get(i);                 if (entry.getestructuralfeature() instanceof ereference) {                     system.out.println(entry.getestructuralfeature().getname() + " {");                     anytype anytype = (anytype) entry.getvalue();                     traverseattributes(anytype.getanyattribute());                     stack.push(anytype.getmixed());                 } else {                     if (entry.getvalue() != null) {                         string value = entry.getvalue().tostring();                         if (value.trim().length() > 0) {                             system.out.println(" " + value + " }");                         }                     } else {                         system.out.println(" }");                     }                 }             }         }     }      private static void traverseattributes(featuremap anyattribute) {         (entry entry : anyattribute) {             system.out.println("attr name: " + entry.getestructuralfeature().getname() + ", attr value: " +                     entry.getvalue().tostring());         }     } } 

// console output code is:

table { attr name: border, attr value: 1 attr name: width, attr value: 100% tbody { thead { tr { th { th { th {  substance }  reaction }  status } tr { tr { tr { td { td { td {  penicillin } content { attr name: id, attr value: reaction1  hives }  active } td { td { td {  aspirin } content { attr name: id, attr value: reaction2  wheezing }  active } td { td { td {  codeine } content { attr name: id, attr value: reaction3  nausea }  active } 

ref: link


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -