Bernard Lebel wrote:
> Hi grouchy,
> 
> I seem to have found the problem. Somehow, it seems BeautifulSoup
> doesn't like nested tags of the same name.

This seems to be a feature of BS. It seems a bit of a misfeature when applied 
to XML but anyway...you can configure BS with a set of tags which can be 
nested, then it will properly parse your data. Here is a short program that 
shows how:

xml = '''<parameter scriptname="posx">
    <fcurve plotted="False">
          <parameter scriptname="extrapolation">1</parameter>
    </fcurve>
</parameter>'''

import BeautifulSoup

class NestingParser(BeautifulSoup.BeautifulStoneSoup):
    NESTABLE_TAGS = BeautifulSoup.buildTagMap([], 'parameter')
    
soup = NestingParser(xml)
print soup.prettify()


Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to