pythonxmlxml-parsingcda

Load XML data into user defined object and save it to a table


I am new to python object oriented programming

I have an XML document derived from clinical document architecture (CDA)

The file has for example:

<repsonsibleAuthority>
    <peroson>
         <address use = 'HB'>
             <street>xxx</street>
         <\address>
    <\person>
<\repsonsibleAuthority>

<creator>
   <fname>fname<\fname>
   <lname>lname<\lname>
   <address use = 'WB'>
      <street>xxxx<\street>
   <\address>
<\creator>

The whole information belongs to one single person, The file has crazy number of levels and I would like to read the file and transform the data some how like relational db.

Questions: 1. How can i use for example address class in multiple classes (inheritance) 2. How can i go through the xml and check the children properties and save relevant information accordingly into an object. 3. Is it wise to save the whole information to an object or transform into tables? if tables are wise, how can i come to conclusion how many tables do i need for each xml and build relations between the tables.

Any information would be really appreciated.


Solution

  • Found a solution:

    Transformed xml to json and then wrote into tables.