En Tue, 01 Apr 2008 20:44:41 -0300, 7stud <[EMAIL PROTECTED]> escribió:
>> I am new to XML parsing.Could you kindly tell me whats the >> problem with the following code: >> >> import xml.dom.minidom >> import xml.parsers.expat > > I don't know if you are aware of the BeautifulSoup module: > Or ElementTree: import xml.etree.ElementTree as ET doctext = """<tokens><token pos="nn">Letterman</token><token pos="bez">is</token><token pos="jjr">better</token><token pos="cs">than</token><token pos="np">Jay</token><token pos="np">Leno</token></tokens>""" doc = ET.fromstring(doctext) for token in doc.findall("token"): print 'pos:', token.get('pos') print 'text:', token.text -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list