I have an extremely large xml file and would like to search for a value and pull out certain values based on that search. My XML looks like this:
It's obviously much larger than this, say several thousand lines. What I would like to do is search for track="0" in the station tag and then pull out track id and train direction. I would like to store this information in a text file with a format that could be imported into excel or something like that. Track ID and Direction would have their own columns. Is this possible using Visual Studio .Net macors?
Todd
Code:
<?xml version="1.0" encoding="UTF-8"?>
<pti xmlns="[URL unfurl="true"]http://www.arinc.com/pti"[/URL]
name="pti"
msgtime="2006-09-06T00:00:00-06:00">
<TrainMovement>
<msgtime>
2006-09-06T00:00:00-06:00 </msgtime>
<track id="UIA-1-1073"/>
<train id="S136" direction="West" revenue="1" dest="">
<station track="1" IsStation="Y">
STA </station>
</train>
</TrainMovement>
<TrainMovement>
<msgtime>
2006-09-06T00:00:04-06:00 </msgtime>
<track id="JCR-1-1037"/>
<train id="105" direction="West" revenue="1" dest="">
<station track="1" IsStation="Y">
WPK </station>
</train>
</TrainMovement>
<TrainMovement>
<msgtime>
2006-09-06T00:00:11-06:00 </msgtime>
<track id="SNA-1-3702"/>
<train id="S122" direction="West" revenue="1" dest="">
<station track="1" IsStation="Y">
SUN </station>
</train>
</TrainMovement>
<TrainMovement>
<msgtime>
2006-09-06T23:59:58-06:00 </msgtime>
<track id="JCR-1-1063"/>
<train id="105" direction="West" revenue="1" dest="">
<station track="0" IsStation="Y">
WPK </station>
</train>
</TrainMovement>
</pti>
It's obviously much larger than this, say several thousand lines. What I would like to do is search for track="0" in the station tag and then pull out track id and train direction. I would like to store this information in a text file with a format that could be imported into excel or something like that. Track ID and Direction would have their own columns. Is this possible using Visual Studio .Net macors?
Todd