{'- ''python xml''- ''python cookbook nd edition''- ''python in nutshell nd edition''- ''learning python th edition''- ''python pocket reference th edition''- ''programming python th edition'dom parsing the dom parsing model for xml is perhaps simpler to understand--we simply traverse tree of objects after the parse--but it might be less efficient for large documentsif the document is parsed all at once ahead of time and stored in memory dom also supports random access to document parts via tree fetchesnested loops for known structuresand recursive traversals for arbitrary nestingin saxwe are limited to single linear parse example - is dom-based equivalent to the sax parser of the preceding section example - pp \lang\xml\dombook py ""xml parsingdom gives whole document to the application as traversable object ""import pprint import xml dom minidom from xml dom minidom import node doc xml dom minidom parse("books xml"mapping {for node in doc getelementsbytagname("book")isbn node getattribute("isbn" node getelementsbytagname("title"for node in ltitle "for node in node childnodesif node nodetype =node text_nodetitle +node data mapping[isbntitle load doc into object usually parsed up front traverse dom object via dom object api mapping now has the same value as in the sax example pprint pprint(mappingthe output of this script is the same as what we generated interactively for the sax parserherethoughit is built up by walking the document object tree after the parse has finished using method calls and attributes defined by the cross-language dom standard specification this is both strength and potential weakness of dom--its api is language neutralbut it may seem bit nonintuitive and verbose to some python programmers accustomed to simpler modelsc:\pp \lang\xmlpython dombook py {'- ''python xml'xml and html parsing