In the below code;
stepOrExpected[i][k] = "Step";
System.out.println(stepOrExpected[i][k]);
by using loop with i and k, I am saving values in stepOrExpected (two dimensional array). Problem here is String is not getting saved. if I print right after I assigned value to stepOrExpected, it is printing null.
Moreover, if I print i and k, both the values are correct.
Please suggest the why String is not getting saved in two dimensional array.
I have pasted my code below, problem I am facing is in
(if (StepLstNode.getNodeName().equals("Step"))
{
stepOrExpected[i][k] = "Step";)
Actual Code:
if (ModulenameLstNode.getNodeType() == Node.ELEMENT_NODE)
{
NodeList TCLst = ModulenameLstNode.getChildNodes();
TCCount = docInput.getElementsByTagName("TC").getLength();
System.out.println(TCCount);
TCID = new String[TCCount];
//TCDepend = new String[TCCount];
TCDescription = new String[TCCount];
stepCountInATCOfModule = new int[TCCount];
ExpectedResult = new String[TCCount];
ActualResult_Pass = new String[TCCount];
ActualResult_Fail = new String[TCCount];
//Result.XMLCreator();
int i=0;
stepOrExpected = new String [TCCount][100];
Action = new String [TCCount][100];
RefObj = new String [TCCount][100];
Val = new String [TCCount][100];
for (int TC = 0; TC < TCLst.getLength(); TC++)
{
int k=0;
Node TCLstNode = TCLst.item(TC);
if (TCLstNode.getNodeType() == Node.ELEMENT_NODE)
{
System.out.println(TCLstNode.getNodeName());
TCID[i] = ObjectType.getAttribute(TCLstNode,"Id");
//TCDepend[i] = ObjectType.getAttribute(TCLstNode,"Depend");
TCDescription[i] = ObjectType.getAttribute(TCLstNode,"Description");
NodeList StepLst = TCLstNode.getChildNodes();
System.out.println(StepLst.getLength());
for (int Step = 0; Step < StepLst.getLength(); Step++)
{
Node StepLstNode = StepLst.item(Step);
if (StepLstNode.getNodeType() == Node.ELEMENT_NODE)
{
if (StepLstNode.getNodeName().equals("Step"))
{
stepOrExpected[i][k] = "Step";
Action[i][k] = ObjectType.getAttribute(StepLstNode,"Action");
RefObj[i][k] = ObjectType.getAttribute(StepLstNode,"RefObj");
Val[i][k] = ObjectType.getAttribute(StepLstNode,"Val");
stepCountInTC++;
k++;
System.out.println(i);
System.out.println(k);
System.out.println(ObjectType.getAttribute(StepLstNode,"Action"));
System.out.println(stepOrExpected[i][k]);
}
else if (StepLstNode.getNodeName().equals("Expected"))
{
stepOrExpected[i][k] = "Expected";
Action[i][k] = ObjectType.getAttribute(StepLstNode,"ExpAction");
RefObj[i][k] = ObjectType.getAttribute(StepLstNode,"ExpTarget");
Val[i][k] = ObjectType.getAttribute(StepLstNode,"ExpVal");
stepCountInTC++;
k++;
}
else if (StepLstNode.getNodeName().equals("ExpectedResult"))
{
ExpectedResult [i] = StepLstNode.getTextContent();
}
else if (StepLstNode.getNodeName().equals("ActualResult_Pass"))
{
ActualResult_Pass [i] = StepLstNode.getTextContent();
}
else
{
ActualResult_Fail [i] = StepLstNode.getTextContent();
}
}//Step NodeType
}//Step for
stepCountInATCOfModule[i] = stepCountInTC;
i++;
stepCountInTC = 0;
}//TC if
}//TC for
}