B
brahatha
I have the following xml
<RootElement>
<colAttempt>
<Attempt attemptid="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 attemptid="2" d="abc>
<ResultElement Result = "123" Msg="success">
<nodeList>
<NodeIwant nodeName="xyz" noFail="0">
<Data ProgId="4"/>
</NodeIwant>
</nodeList>
</ResultElement>
</Attempt>
</colAttempt>
</RootElement>
I am trying to get my final result as follows.
Attempt 1:
<NodeIwant nodeName="conf" noFail="1">
<NodeIwant nodeName="nconf" noFail="0">
Attempt 2:
<NodeIwant nodeName="xyz" noFail="0">
So far in my code, I have extracted no of Attempts which is 2 and
looping through that. Now what I am trying to do is to get no of
NodeIwant, so that I can loop through that. So for each Attempt, I
need to get no of NodeIwant and then print the result.
so my xpath is this, /RootElement/colAttempt/Attempt[@attemptid =
$AttrValue]/ResultElement/
nodeList/NodeIwant
where $AttrValue is declared like this,
String AttrValue = element.getAttribute("attemptid"); ( this extracts
attemptid value from /RootElement/colAttempt/Attempt). Code gets
compiled with no problem. But during run time, I get NPE.
java.lang.NullPointerException
at
com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack.getVariableOrPara
m(Unknown Source)
at
com.sun.org.apache.xpath.internal.operations.Variable.execute(Unknown
Sour
ce)
at
com.sun.org.apache.xpath.internal.operations.Operation.execute(Unknown
Sou
<RootElement>
<colAttempt>
<Attempt attemptid="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 attemptid="2" d="abc>
<ResultElement Result = "123" Msg="success">
<nodeList>
<NodeIwant nodeName="xyz" noFail="0">
<Data ProgId="4"/>
</NodeIwant>
</nodeList>
</ResultElement>
</Attempt>
</colAttempt>
</RootElement>
I am trying to get my final result as follows.
Attempt 1:
<NodeIwant nodeName="conf" noFail="1">
<NodeIwant nodeName="nconf" noFail="0">
Attempt 2:
<NodeIwant nodeName="xyz" noFail="0">
So far in my code, I have extracted no of Attempts which is 2 and
looping through that. Now what I am trying to do is to get no of
NodeIwant, so that I can loop through that. So for each Attempt, I
need to get no of NodeIwant and then print the result.
so my xpath is this, /RootElement/colAttempt/Attempt[@attemptid =
$AttrValue]/ResultElement/
nodeList/NodeIwant
where $AttrValue is declared like this,
String AttrValue = element.getAttribute("attemptid"); ( this extracts
attemptid value from /RootElement/colAttempt/Attempt). Code gets
compiled with no problem. But during run time, I get NPE.
java.lang.NullPointerException
at
com.sun.org.apache.xpath.internal.jaxp.JAXPVariableStack.getVariableOrPara
m(Unknown Source)
at
com.sun.org.apache.xpath.internal.operations.Variable.execute(Unknown
Sour
ce)
at
com.sun.org.apache.xpath.internal.operations.Operation.execute(Unknown
Sou