B
brahatha
I am trying to come up with a Java code where I can read a xml file
and extract particular element/attribute. This is the structure of
xml
I have
<RootElement>
<colAttempt>
<Attempt a="1" b="abc>
<ResultElement Result = "123" Msg="success">
<nodeList>
<NodeIwant nodeName="conf" noFail="1">
<Data ProgId="294"/>
</NodeIwant>
<NodeIwant nodeName="nconf" noFail="0">
<Data ProgId="3"/>
</NodeIwant>
</nodeList>
</ResultElement>
</Attempt>
<Attempt c="2" d="abc>
<ResultElement Result = "123" Msg="success">
<nodeList>
<NodeIwant nodeName="xyz" noFail="0">
<Data ProgId="4"/>
</NodeIwant>
</nodeList>
</ResultElement>
</Attempt>
</colAttempt>
</RootElement>
I need to extract <NodeIwant nodeName="" noFail =""> for each
iteration of Attempt.In the above example, I have two Attempts ( 1
and
2 ). So my output should show, for attempt 1 following result
<NodeIwant nodeName="conf" noFail="1">
<NodeIwant nodeName="nconf" noFail="0">
For attempt 2 following
<NodeIwant nodeName="xyz" noFail="0">
So final result should be like this,
Attempt 1:
<NodeIwant nodeName="conf" noFail="1">
<NodeIwant nodeName="nconf" noFail="0">
Attempt 2:
<NodeIwant nodeName="xyz" noFail="0">
NEED HELP!
and extract particular element/attribute. This is the structure of
xml
I have
<RootElement>
<colAttempt>
<Attempt a="1" b="abc>
<ResultElement Result = "123" Msg="success">
<nodeList>
<NodeIwant nodeName="conf" noFail="1">
<Data ProgId="294"/>
</NodeIwant>
<NodeIwant nodeName="nconf" noFail="0">
<Data ProgId="3"/>
</NodeIwant>
</nodeList>
</ResultElement>
</Attempt>
<Attempt c="2" d="abc>
<ResultElement Result = "123" Msg="success">
<nodeList>
<NodeIwant nodeName="xyz" noFail="0">
<Data ProgId="4"/>
</NodeIwant>
</nodeList>
</ResultElement>
</Attempt>
</colAttempt>
</RootElement>
I need to extract <NodeIwant nodeName="" noFail =""> for each
iteration of Attempt.In the above example, I have two Attempts ( 1
and
2 ). So my output should show, for attempt 1 following result
<NodeIwant nodeName="conf" noFail="1">
<NodeIwant nodeName="nconf" noFail="0">
For attempt 2 following
<NodeIwant nodeName="xyz" noFail="0">
So final result should be like this,
Attempt 1:
<NodeIwant nodeName="conf" noFail="1">
<NodeIwant nodeName="nconf" noFail="0">
Attempt 2:
<NodeIwant nodeName="xyz" noFail="0">
NEED HELP!