Note that there are some explanatory texts on larger screens.

plurals
  1. POXML parsing to get description using python using minidom
    primarykey
    data
    text
    <p>Please suggest me what add additional code need to be added for the below code so that i can parse the below XML code to get the description.</p> <pre><code>&lt;SquishReport version="2.1"&gt; &lt;test name="HMI_testing"&gt; &lt;prolog time="2013-01-22T18:59:43+05:30"/&gt; &lt;test name="tst_Setup_menu_2"&gt; &lt;prolog time="2013-01-22T18:59:43+05:30"/&gt; &lt;verification line="7" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="ECG is enabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'1' and 'True' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;ECG is enabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;verification line="9" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="ECG is enabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'1' and 'True' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;ECG is enabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;verification line="11" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="P1 is disabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'0' and 'False' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;P1 is disabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;verification line="13" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="P2 is disabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'0' and 'False' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;P2 is disabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;verification line="15" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="SPO2 is enabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'1' and 'True' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;SPO2 is enabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;verification line="17" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="CO2 is disabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'0' and 'False' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;CO2 is disabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;verification line="19" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="RESP is disabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'0' and 'False' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;RESP is disabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;verification line="21" type="" file="D:/Squish/HMI_testing/tst_Setup_menu_2/test.py" name="TEMP is disabled"&gt; &lt;result type="PASS" time="2013-01-22T18:59:45+05:30"&gt; &lt;description&gt;Comparison&lt;/description&gt; &lt;description type="DETAILED"&gt;'0' and 'False' are equal&lt;/description&gt; &lt;description type="DETAILED"&gt;TEMP is disabled&lt;/description&gt; &lt;/result&gt; &lt;/verification&gt; &lt;epilog time="2013-01-22T18:59:45+05:30"/&gt; &lt;/test&gt; &lt;epilog time="2013-01-22T18:59:45+05:30"/&gt; &lt;/test&gt; &lt;/SquishReport&gt; </code></pre> <p>what i need to print is ECG is Enabled , NIBP is enabled etc..</p> <p>the code i used is added below. I need to update the same code because of some dependency. need to add the code at print(Need to add the code here) mentioned in the code</p> <pre><code>import sys import xml.dom.minidom as XY file = open("Result_Summary.txt", "w") tree = XY.parse('Results-On-2013-01-22_0659.xml') #print (str(sys.argv[1])) #tree = XY.parse(sys.argv[1]) Test_name = tree.getElementsByTagName('test') count_testname =0 file.write(' -----------------------------------------------------------------------------------------------------\n\n') file.write('\tTest Name \t\t No Of PASS\t\t No Of FAIL\t\t\t Description\t\t \n') file.write(' -----------------------------------------------------------------------------------------------------\n\n') for my_Test_name in Test_name: count_testname = count_testname+1 my_Test_name_final = my_Test_name.getAttribute('name') if(count_testname &gt; 1): #print(my_Test_name_final) file.write(my_Test_name_final) file.write('\t\t\t') my_Test_status = my_Test_name.getElementsByTagName('result') passcount = 0 failcount = 0 for my_Test_status_1 in my_Test_status: my_Test_description = my_Test_name.getElementsByTagName('description') for my_Test_description_1 in my_Test_description: my_Test_description_final = my_Test_description_1.getAttribute('type') print(Need to add the code here) my_Test_status_final = my_Test_status_1.getAttribute('type') if(my_Test_status_final == 'PASS'): passcount = passcount+1 if(my_Test_status_final == 'FAIL'): failcount = failcount+1 #print(str(my_Test_status_final)) file.write(str(passcount)) #print(passcount) file.write('\t\t\t') file.write(str(failcount)) </code></pre> <p>Ex</p> <pre><code>pected result tst_Setup_menu_2 8 0 ECG Enabled p1 Enabled P2 Enabled etc </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload