dealing with nested xml within nested xml within......

Ultrus owntheweb at gmail.com
Mon Jul 9 22:03:44 CEST 2007


Hello all,
I don't need specific examples, but I'm trying to wrap my head around
parsing xml within xml and even further, not limiting how far someone
will nest xml. I'm already making great use of BeautifulSoup's
BeautifulStoneSoup to parse xml, but what do I do if I come across
something like this?

<random>
   <li>This is a random response (once parsed)</li>
   <li>
      <random>
         <li>This is a random response within a random response</li>
         <li>
            <random>
               <li>This is a random response within a random response,
within another random response</li>
               <li>Like above, this is another random response.</li>
            </random>
         </li>
      </random>
   </li>
</random>

Not knowing how far one will nest random responses, how would one
manage digging into xml like this? Right now I'm thinking about not
even going there. I would presently write scripts that would parse 3
or so levels deep, but no further. :P It would make an interesting
project, like an interactive adventure story.




More information about the Python-list mailing list