title: Generating XML from nested numbered lists in Python
body: <p>I have a nested, numbered list structure like this:</p>
  
  <blockquote>
    <p>1.1 - "james"<br>
    1.1.1 - "alice"<br>
    1.2.1 - "bob"</p>
  </blockquote>
  
  <p>What is the best/fastest way to turn it into an XML structure like this:</p>
  
  <pre><code>&gt; &lt;1&gt;  
  &gt;    &lt;1&gt;&lt;james/&gt;
  &gt;       &lt;1&gt;&lt;alice/&gt;&lt;/1&gt;
  &gt;       &lt;2&gt;&lt;bob/&gt;&lt;/2&gt;
  &gt;    &lt;/1&gt;  
  &gt; &lt;/1&gt;  
  </code></pre>
  
  <p>This is super easy if the depth of the numbered lists is only 3, but in this case it is unknown, maybe up to 6.
  I'm pretty sure I need to create a recursive self-referential function but need a way of putting each element in its place within the XML structure, which I'm stuck on at the moment. </p>