I have an xml in this format
<RECORD>
<RUN_TEST_SUCCESS>
<TEST_NAME>test1 </TEST_NAME>
</RUN_TEST_SUCCESS>
</RECORD>
<RECORD>
<RUN_TEST_FAILURE>
<TEST_NAME> test2</TEST_NAME>
<FILE_NAME> eg.c </FILE_NAME>
<LINE_NUMBER> 478 </LINE_NUMBER>
<CONDITION> condition1</CONDITION>
</RUN_TEST_FAILURE>
</RECORD>
......
How do i parse only run_test_failure tag and get the information inside it using xlint?
I have tried xlint --xpath 'string(/RECORD[2]/RUN_TEST_FAILURE/TEST_NAME)' myxml.xml gives me the correct value , but i do not know the position 'i' (here 2) for the failures. I only have the number of run_test_failure tags information. How to iterate of all the record tags, check if "run_test_failure" tag is present and then extract information?
No comments:
Post a Comment