'- ''python in nutshell nd edition''- ''learning python th edition''- ''python pocket reference th edition''- ''programming python th edition'elementtree parsing as fourth optionthe popular elementtree package is standard library tool for both parsing and generating xml as parserit' essentially more pythonic type of dom--it parses documents into tree of objects againbut the api for navigating the tree is more lightweightbecause it' python-specific elementtree provides easy-to-use tools for parsingchangingand generating xml documents for both parsing and generatingit represents documents as tree of python "elementobjects each element in the tree has tag nameattribute dictionarytext valueand sequence of child elements the element object produced by parse can be navigating with normal python loops for known structuresand with recursion where arbitrary nesting is possible the elementtree system began its life as third-party extensionbut it was largely incorporated into python' standard library as the package xml etree example - shows how to use it to parse our book catalog file one last time example - pp \lang\xml\etreebook py ""xml parsingelementtree (etreeprovides python-based api for parsing/generating ""import pprint from xml etree elementtree import parse mapping {tree parse('books xml'for in tree findall('book')isbn attrib['isbn'for in findall('title')mapping[isbnt text pprint pprint(mappingwhen run we get the exact same results as for sax and dom againbut the code required to extract the file' details seems noticeably simpler this time aroundc:\pp \lang\xmlpython etreebook py {'- ''python xml''- ''python cookbook nd edition''- ''python in nutshell nd edition''- ''learning python th edition''- ''python pocket reference th edition''- ''programming python th edition' text and language