Processing two XML documents to find results [closed]

Freak2009

New Member
I have some XML documents:events.xml:\[code\]<?xml version="1.0" encoding="UTF-8"?><events> <event> <id>9</id> <region>3</region> <region>12</region> <region>29</region> </event> <event> <id>7</id> <region>1</region> <region>12345</region> </event> <event> <id>3</id> <region>12</region> <region>39</region> <region>56</region> </event> <event> <id>8</id> <region>8</region> <region>123</region> <region>456</region> </event> <event> <id>4</id> <region>999</region> <region>888</region> <region>777</region> </event></events>\[/code\]exposure.xml:\[code\]<?xml version="1.0" encoding="UTF-8"?><companies> <company> <id>6</id> <region>3</region> <region>9</region> <region>8</region> <region>11111</region> <region>12</region> </company> <company> <id>4</id> <region>3</region> <region>6</region> <region>7</region> <region>12345</region> </company> <company> <id>9</id> <region>1</region> <region>2</region> <region>3</region> </company></companies>\[/code\]I need to write a program to process the two files:\[quote\] For each event in the event file the program should write out the event number followed by the set of companies it affects in the exposure file. The list of companies should be written out in ascending company number.\[/quote\]Given the sample files, the output should be something like this: 9 4 6 9 8 6 7 4 9 3 6
 
Back
Top