Popular recipes by Uche Ogbuji http://code.activestate.com/recipes/users/509776/2005-04-10T06:06:10-07:00ActiveState Code RecipesSAX to DOM Chunker (Python) 2004-08-06T08:48:59-07:00Uche Ogbujihttp://code.activestate.com/recipes/users/509776/http://code.activestate.com/recipes/298343-sax-to-dom-chunker/ <p style="color: grey"> Python recipe 298343 by <a href="/recipes/users/509776/">Uche Ogbuji</a> (<a href="/recipes/tags/xml/">xml</a>). </p> <p>This module is similar to pulldom in that it takes a stream of SAX objects and breaks it down into chunks of DOM. The differences are that it works with any DOM implementation meeting the Python DOM conventions, and that it uses simple pattern expressions to declaratively set how the DOM chunks are partitioned, rather than requiring the user to write procedural code for this purpose. This is an updated/fixed version of code that appeared in an <a href="http://XML.com" rel="nofollow">XML.com</a> column.</p> A SAX filter for normalizing text events (Python) 2005-04-10T06:06:10-07:00Uche Ogbujihttp://code.activestate.com/recipes/users/509776/http://code.activestate.com/recipes/265881-a-sax-filter-for-normalizing-text-events/ <p style="color: grey"> Python recipe 265881 by <a href="/recipes/users/509776/">Uche Ogbuji</a> (<a href="/recipes/tags/xml/">xml</a>). Revision 2. </p> <p>A SAX parser can report contiguous text using multiple characters events. This is often unexpected and can cause obscure bugs or require complicated adjustments to SAX handlers. By inserting text_normalize_filter into the SAX handler chain all downstream parsers are ensured that all text nodes in the document Infoset are reported as a single SAX characters event.</p> Merging XBEL Bookmark files (Python) 2002-06-23T14:46:14-07:00Uche Ogbujihttp://code.activestate.com/recipes/users/509776/http://code.activestate.com/recipes/135131-merging-xbel-bookmark-files/ <p style="color: grey"> Python recipe 135131 by <a href="/recipes/users/509776/">Uche Ogbuji</a> (<a href="/recipes/tags/xml/">xml</a>). </p> <p>This recipe uses DOM (precisely, cDomlette or the minidom variant in 4Suite) to merge two files containing XBEL boomark listings. It uses Python 2.2. generators for straightforward and efficient iteration over the XBEL DOM trees in document order. It requires Python 2.2 and 4Suite 0.12.0a2 or more recent versions.</p>