I am having trouble with the tFileInputXML(FIX) component. I have an XML file that I believe will need to be processed by more than one FIX because it has multiple nested elements. My plan is to process that XML file and store it in a database. As of right now I will have an individual table for each nest level in the XML file. Each of the nested data elements will have an index that will reference it back to its parent, which came from the XML file. Is this the best way to store the data?
The XML file looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>
<name>Bob Dylan</name>
<name>Fake Name</name>
</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>
<name>Bonnie Tyler</name>
</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title>Greatest Hits</title>
<artist>
<name>Dolly Parton</name>
</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
</catalog>
The <cd> and <name> tags repeat. Because I cannot have more than one xpath look in the FIX I figure I have to use two FIX components to pull this data out. Correct me if I am wrong.
So if all this is correct. How do I associate the two FIX input streams with each other so when I place then in the DB I can give them the correct index to find their parent element? How can I retain that parent/child relationship as I process the file in different FIXs?
I found a solution by splitting up the jobs. I read one level of the XML doc. Dump that in to the DB. Then read the next level using the DB to reference the data from the first XML pull.
Anyone else have this sort of problem? I would think most people working with XML would have issues with the single loop aspect of the FIX. Is there a better way to deal with this?