Home | Trees | Indices | Help |
|
---|
|
1 # Natural Language Toolkit: Support for OLAC Metadata 2 # 3 # Copyright (C) 2001-2008 NLTK Project 4 # Author: Steven Bird <[email protected]> 5 # URL: <http://nltk.org> 6 # For license information, see LICENSE.TXT 7 8 9 from StringIO import StringIO 1012 """ 13 Read an OLAC XML record and return a list of attributes. 14 15 @param xml: XML string for conversion 16 @type xml: C{string} 17 @rtype: C{list} of C{tuple} 18 """ 19 from lxml import etree 20 21 root = etree.parse(StringIO(xml)).getroot() 22 return [(element.tag, element.attrib, element.text) for element in root.getchildren()]23 32 40 41 if __name__ == '__main__': 42 demo() 43 44 __all__ = ['read_olac', 'pprint_olac'] 45
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Wed Aug 27 15:09:17 2008 | http://epydoc.sourceforge.net |