document once the tree has been builtdom provides an interface for traversing the tree and extracting data neither the sax nor dom apis originate with python insteadpython simply copies the standard programming interface that was developed for java and javascript although you can certainly process xml using the sax and dom interfacesthe most convenient programming interface in the standard library is the elementtree interface this is python-specific approach to xml parsing that takes full advantage of python language features and which most users find to be significantly easier and faster than sax or dom the rest of this section covers all three xml parsing approachesbut the elementtree approach is given the most detail readers are advised that the coverage here is really only focused on basic parsing of xml data python also includes xml modules related to implementing new kinds of parsersbuilding xml documents from scratchand so forth in additiona variety of third-party extensions extend python' capabilities with additional xml features such as support for xslt and xpath links to further information can be found at wiki python org/moin/pythonxml xml example document the following example illustrates typical xml documentin this case description of recipe famous guacamole southwest favoritelarge avocadoschopped tomatochopped white onionchopped fresh squeezed lemon juice jalapeno pepperdiced fresh cilantrominced garlicminced salt ice-cold beer combine all ingredients and hand whisk to desired consistency serve and enjoy with ice-cold beers the document consists of elements that start and end with tags such as elements are typically nested and organized into hierarchy-for examplethe elements that appear under within each documenta single element is the document root in the examplethis is the element elements optionally have attributes as shown for the item elements <item num=" ">large avocadoschopped working with xml documents typically involves all of these basic features for exampleyou may want to extract text and attributes from specific element types to lib fl ff