I have two XML files that I need to parse into one record. The first document contains data for most of the record, but there is a field holds an identifier for fetching data from the second XML file, somewhat like
File 1:
<nodes>
<node>
<key1>value1</key1>
<!-- etc -->
<keyN>valueN</keyN>
<reference>1</reference
</node>
</nodes>
File 2:
<refs>
<ref id="1">refValue1</ref>
<ref id="2">refValue2</ref>
</refs>
What I would like to do is while parsing the first document, retrieving the values from the key elements, is when I extract the value of <reference>
, I immediately fetch the contents of <ref id="1">
from the second file.
Since I am very new to Arrows, this is proving to be quite a challenge for me to figure out how to do. I'm able to parse the first XML file just fine, but I don't know how to pass in the second document to be used on demand.
At phg's suggestion, I tried parsing the second XML file into a Map first, then passing it into the parser for the first XML file. A little bit of fiddling and tweaking and I got it working.