Good afternoon, I need help to parse a document .XML in Python, I just need to know the best way to printearlo in the console (bash or cmd). the question is that I have already managed to parse the document, but in it there are elements that are repeated example <p>
. How do I print all the elements as well as their childs when they are repeated. in other words I want to print <p>
and its childs ( tag
and texto
) and how it repeats also print it. If you explain to me? ... Thank you in advance to those who can collaborate. Regards!
XML document:
<?xml version="1.0" encoding="UTF-8"?>
<resulset>
<a>
<r_l>text 1</r_l>
<v>1.0</v>
<o_g>
<t>text 2</t>
<o>text 3</o>
<d>text 4</d>
</o_g>
<ps>
<p>
<t>text 5</t>
<i_n>text 6</i_n>
<ln>text 7</ln>
<fn>text 8</fn>
<p_t></p_t>
<db></db>
<fi>text 9</fi>
<ff></ff>
</p>
<p>
<t>text 10</t>
<i_n>text 11</i_n>
<ln>text 12</ln>
<fn>text 13</fn>
<p_t>text 14</p_t>
<db></db>
<fi>text 15</fi>
<ff></ff>
</p>
</ps>