title: Parse XML using Python and printing the whole element
body: <p>This is my first question here. Usually I can find what I need, but after a week of searching and trying I am at the same place, so I need your help.</p>
  
  <p>I have a book that is in a large XML file that is over 6000 lines long. What I need to do is to take an element <code>&lt;sec&gt;</code> and put it's content in a string. Sometimes that element has only one paragraph, and sometimes it has more, sometimes paragraph has lists, and other things, and I need to capture that all in a string.</p>
  
  <p>Here is an example how book is formated.</p>
  
  <pre><code>&lt;book&gt;
      &lt;book-body&gt;
          &lt;book-part id="ch01" book-part-type="chapter"&gt;
              &lt;book-part-meta&gt;
                  &lt;title-group&gt;
                      &lt;label&gt;&lt;target target-type="page" id="pg1"/&gt;Chapter 1&lt;/label&gt;
                      &lt;title&gt;Some Title&lt;/title&gt;
                  &lt;/title-group&gt;
              &lt;/book-part-meta&gt;
              &lt;body&gt;
                  &lt;sec id="ch01lev1sec1" disp-level="level1"&gt;
                      &lt;title&gt;Introduction&lt;/title&gt;
                      &lt;p&gt;This is a &lt;em&gt;paragraph&lt;/em&gt;&lt;/p&gt;
                      &lt;p&gt;This is second paragraph
                          &lt;list list-type="bullet"&gt;
                          &lt;list-item&gt;&lt;p&gt;List Item 1&lt;/p&gt;&lt;/list-item&gt;
                          &lt;list-item&gt;&lt;p&gt;List Item 2&lt;/p&gt;&lt;/list-item&gt;
                          &lt;list-item&gt;&lt;p&gt;List Item 3&lt;/p&gt;&lt;/list-item&gt;
                          &lt;/list&gt;
                      &lt;/p&gt;
                  &lt;/sec&gt;
              &lt;/body&gt;
          &lt;/book-part&gt;
      &lt;/book-body&gt;
  &lt;/book&gt;
  </code></pre>
  
  <p>And from this example I need everything inside the  tag (ideally without a title, but I will figure that out later). 
  I have tried using "xml.etree.ElementTree", and using "minidom" but unsuccessfully.</p>
  
  <p>Here is an example of my code using minidom</p>
  
  <pre><code>from xml.dom import minidom
  
  xmldoc = minidom.parse("xCHES.xml")
  
  book = xmldoc.getElementsByTagName("book")[0]
  
  sec = book.getElementsByTagName("sec")
  </code></pre>
  
  <p>And when I list a number of elements I get the same number as when I search for "<code>&lt;sec</code>" in xml file, so I guess I got them all. 
  After this point I am stuck, I can't find the way how to extract everything as a text.</p>
  
  <p>The same thing is with "ElementTree", I can locate all <code>&lt;sec&gt;</code> elements but I can't extract the text, or just extract the small part of it.</p>
  
  <p>So if anyone can help me with this problem, it would be great. It doesn't matter what method, as long as it finishes the job.</p>
  
  <p>EDIT:
  Desired output would be</p>
  
  <pre><code>&lt;title&gt;Introduction&lt;/title&gt;
  &lt;p&gt;This is a &lt;em&gt;paragraph&lt;/em&gt;&lt;/p&gt;
  &lt;p&gt;This is second paragraph
      &lt;list list-type="bullet"&gt;
      &lt;list-item&gt;&lt;p&gt;List Item 1&lt;/p&gt;&lt;/list-item&gt;
      &lt;list-item&gt;&lt;p&gt;List Item 2&lt;/p&gt;&lt;/list-item&gt;
      &lt;list-item&gt;&lt;p&gt;List Item 3&lt;/p&gt;&lt;/list-item&gt;
      &lt;/list&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>But as a sting. This could be in one line, formatting is irrelevant.</p>
  
  <p>Thank you :)</p>