I have an XML file that I am trying to parse with Sax (this is my first time doing this). I researched how to implement a parser, and that everything makes sense, but I'm not sure how best to solve this problem.
I scattered pieces of related data (two facts are related to FactKey). In the example below, Foo has a value of 5.34.
Sax calls StartElement () for each new element, so this is one fact call and one value call .... so my questions is: I need to store the FactKey from the Facts element so that I can associate it with the Value element in the next pass, or is there any way for Sax to do this automatically?
And is there any way to combine two different facts with the same FactKey, perhaps if I used the DOM instead of Sax? Or is it just wishful thinking, and in fact I just need to support a multimap or something like that.
... <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>
Steve source share