I have an XML file that I am trying to parse with Sax (this is my first time doing this). I've researched how to implement the parser, and that all makes sense, but I'm unsure of the best way to tackle this problem.
I have scattered pieces of related data (two Facts are associated by a FactKey). In the example below, Foo has a value of 5.34.
Sax calls StartElement() on every new element, so that is one call for Facts and one call for Value....so my questions are: Do I have to store FactKey from the Facts element so I can associate it with the Value element on the next pass, or is there a way for Sax to do that automatically?
And is there any facility built in for associating two different Facts with the same FactKey, perhaps if I used DOM instead of Sax? Or is that just wishful thinking, and I actually just need to maintain a multimap or something.
...
<Facts FactKey="2832154551" FieldId="73250">
<Value xsi:type="xs:double">5.3499999</Value>
</Facts>
...
<Facts FactKey="2832154551" FieldId="410288">
<Value xsi:type="xs:string">Foo</Value>
</Facts>