Friday, June 24, 2011

Parsing Multiple XML Tags

How to parse XML with different multiple tags? For instance, I have a root tag element and few child tags with same name. For below is the snippet for the XML I will be providing parsers for
Multiple XML Tags
multiple-tags.xml
<?xml version="1.0" encoding="UTF-8"?>
<rootTag Name="Root">
 <ChildOne activityType="Task">
  <Name>P1</Name>
  <Incoming>0</Incoming>
  <Outgoing>P1P2</Outgoing>
 </ChildOne>
 <ChildOne activityType="Task">
  <Name>P2</Name>
  <Incoming>P1P2</Incoming>
  <Outgoing>P2G1</Outgoing>
 </ChildOne>
 <ChildOne activityType="GatewayParallel">
  <Name>G1</Name>
  <Incoming>P2G1</Incoming>
  <Outgoing>G1P3 G1P4</Outgoing>
 </ChildOne>
 <ChildTwo type="bpmn:SequenceEdge">
  <Name>P1P2</Name>
  <Source>P1</Source>
  <Destination>P2</Destination>
  <Path>P1P2</Path>
 </ChildTwo>
 <ChildTwo type="bpmn:SequenceEdge">
  <Name>P2G1</Name>
  <Source>P2</Source>
  <Destination>G1</Destination>
  <Path></Path>
 </ChildTwo>
 <ChildTwo type="bpmn:SequenceEdge">
  <Name>G1P3</Name>
  <Source>G1</Source>
  <Destination>P3</Destination>
  <Path>P2P3</Path>
 </ChildTwo>
</rootTag>