defined test_h include stdio include lib/spam include python defined debug defined hello 'hello regex world defined spam defined eggs sunny side up defined adder (arg arg for an additional example of regular expressions at worksee the file pygrep py in the book examples packageit implements simple pattern-based "grepfile search utilitybut was cut here for space as we'll seewe can also sometimes use regular expressions to parse information from xml and html text--the topics of the next section xml and html parsing beyond string objects and regular expressionspython ships with support for parsing some specific and commonly used types of formatted text in particularit provides precoded parsers for xml and html which we can deploy and customize for our text processing goals in the xml departmentpython includes parsing support in its standard library and plays host to prolific xml special-interest group xml (for extensible markup languageis tag-based markup language for describing many kinds of structured data among other thingsit has been adopted in roles such as standard database and internet content representation in many contexts as an object-oriented scripting languagepython mixes remarkably well with xml' core notion of structured document interchange xml is based upon tag syntax familiar to web page writersused to describe and package data the xml module package in python' standard library includes tools for parsing this data from xml textwith both the sax and the dom standard parsing modelsas well as the python-specific elementtree package although regular expressions can sometimes extract information from xml documentstoothey can be easily misled by unexpected textand don' directly support the notion of arbitrarily nested xml constructs (more on this limitation later when we explore languages in generalin shortsax parsers provide subclass with methods called during the parsing operationand dom parsers are given access to an object tree representing the (usuallyalready parsed document sax parsers are essentially state machines and must record (and possibly stackpage details as the parse progressesdom parsers walk object trees using loopsattributesand methods defined by the dom standard elementtree is roughly python-specific analog of domand as such can often yield simpler codeit can also be used to generate xml text from their object-based representations xml and html parsing