I am trying to parse an xml file for the attributes:
Testcase: name & status
testSteps: expected, actual, & status
but I'm getting this error:
[Fatal Error] xmltestdata.xml:4:1635: The value of attribute "expected" associated with an element type "testSteps" must not contain the '<' character.
What is the reason I would be getting this error?
Java
private static JiraIssue parseXML(String xmlFile) {
try {
//Read the XML File
File xmlFile1 = new File(xmlFile);
DocumentBuilderFactory dbFactory
DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(xmlFile1);
doc.getDocumentElement().normalize();
System.out.println("Root element :" +
doc.getDocumentElement().getNodeName());
}
finally {
return null;
}
}
XML (Sorry about the poor formatting)
<xml>
<testSuite name="Suite: Test Reporter" startTime="05/22/2017 14:07:57" endTime="05/22/2017 14:07:57">
<!-- name would have the (1) MSA ticket and (2) test status-->
<testCase name="MSA001|en|us" status="Pass">
<!-- below could be the (3) comment-->
<testSteps name="Step 1" expected="Γεια σας. ξεκινήστε με τη UPS." actual="Γεια σας. ξεκινήστε με τη UPS." status="Pass" />
<testSteps name="Step 2" expected="Αποστολή" actual="Αποστολή" status="Pass" /> </testCase>
<testCase name="MSA002|en|ca" status="Fail">
<testSteps name="Step 1" expected="Bonjour. Démarrez avec UPS." actual="Bonjour. Démarrez avec UPS." status="Pass" />
<testSteps name="Step 2" expected="Bonjour. Démarrez avec UPS." actual="Not found" status="Fail" /> </testCase>
<testCase name="MSA003|en|fr" status="Skip">
<testSteps name="Step 1" expected="Dobrý den. začněte využívat služby UPS." actual="Αποστολή" status="Fail" />
<testSteps name="Step 3" expected="Dobrý den. začněte využívat služby UPS." actual="Dobrý den. začněte využívat služby UPS." status="Pass" /> </testCase>
<testCase name="MSA004|en|ls" status="Fail">
<testSteps name="Step 1" expected="Dobrý den. začněte využívat služby UPS." actual="Αποστολή" status="Fail" />
<testSteps name="Step 2" expected="Dobrý den. začněte využívat služby UPS." actual="Dobrý den. začněte využívat služby UPS." status="Pass" /> </testCase>
<testCase name="MSA005|en|us" status="Fail">
<testSteps name="Step 1" expected="<b>Γεια σας. ξεκινήστε με τη UPS.</b>" actual="Γεια σας. ξεκινήστε με τη UPS." status="Pass" />
<testSteps name="Step 2" expected="Αποστολή" actual="Αποστολή" status="Fail" /> </testCase>
</testSuite>
</xml>`
<testSteps name="Step 1" expected="<b>Γεια σας. ξεκινήστε με τη UPS.</b>" actual="Γεια σας. ξεκινήστε με τη UPS." status="Pass" />- the<b>and</b>are invalid