AnsweredAssumed Answered

Import XML data

Question asked by jeffb on Aug 13, 2013
Latest reply on Dec 21, 2014 by user19752



I am looking for assistance with an XML import. I am new to xml so have only a rudimentary understanding.


The xml I'm working with has all of its data contained within attributes. Every element has the same name (<DI>), what would correspond to a FileMaker field name is in an attribute (K="") and the actual data is in another attribute (V="")




<DI K="Patient" T="0">
 <DI K="DateOfBirth" T="1" V="19400423"/>
 <DI K="DicomPatientId" T="1" V="STUDYID"/>
 <DI K="FamilyName" T="1" V="STUDYNAME"/>
 <DI K="GivenName" T="1" V="FULLSTUDYNAME"/>
 <DI K="MiddleName" T="1" V=""/>
 <DI K="NamePrefix" T="1" V=""/>
 <DI K="NameSuffix" T="1" V=""/>
 <DI K="PatientUID" T="1" V="1.2.276"/>
 <DI K="Sex" T="1" V=""/>


There are also sections of "repeating" data, using the same structure of <DI> elements, and K, V (and other) attributes.




<DI K="Value000" T="0">
 <DI K="Description" T="1" V="Left Ventricle - Stroke Volume - 2D mode - Method of Disks, Single Plane - Apical four chamber"/>
 <DI K="FindingId" T="1" V="LV.SV.2D.SP.A4C"/>
 <DI K="Label" T="1" V="SV (A4C)"/>
 <DI K="ResultToUse" T="1" V=""/>
 <DI K="Unit" T="1" V="ml"/>
 <DI K="Value" T="1" V="60.2"/>
 <DI K="ValueToUse" T="1" V="60.2"/>
 <DI K="Value001" T="0">
 <DI K="Description" T="1" V="Left Ventricle - Major axis length diastolic difference - End Diastole - 2D mode"/>
 <DI K="FindingId" T="1" V="LV.REL_DIF_MAJAX.ED.2D"/>
 <DI K="Label" T="1" V="difD"/>
 <DI K="ResultToUse" T="1" V=""/>
 <DI K="Unit" T="1" V="%"/>
 <DI K="Value" T="1" V="5.27"/>
 <DI K="ValueToUse" T="1" V="5.27"/>
 <DI K="Value002" T="0">
 <DI K="Description" T="1" V="Mitral Valve - Dome Radius - Regurgitant Flow - Doppler Mode - Proximal Isovelocity Surface Area"/>
 <DI K="FindingId" T="1" V="MV.DOME.RegFlow.Doppler.PISA"/>
 <DI K="Label" T="1" V="Radius"/>
 <DI K="ResultToUse" T="1" V="Average"/>
 <DI K="Unit" T="1" V="mm"/>
 <DI K="Value" T="1" V="2.9\\\\"/>
 <DI K="ValueToUse" T="1" V="2.9"/>


The total number of these sections is defined at the beginning of the file in:


<DI K="NumberOfValues" T="2" V="32"/>


I'm stuck on how to proceed. I understand how all the "parts" correspond to FileMaker fields, records, tables, etc. I don't know how to proceed with writing a stylesheet to import the data.


Can anyone point me in the right direction, or point me to resources on transforming xml data that is structured in this way? Unfortunately in all of the references I've looked at (xml/xslt books, Google) the data is contained in elements (with different names) not attributes.


Thanks in advance.


PS-Hope I've posted this okay -- first time posting to these forums