Top-rated recipes by Paul Prescod http://code.activestate.com/recipes/users/11203/top/2001-06-14T19:42:23-07:00ActiveState Code RecipesRead data from .zip files (Python)
2001-03-14T17:22:33-08:00Paul Prescodhttp://code.activestate.com/recipes/users/11203/http://code.activestate.com/recipes/52265-read-data-from-zip-files/
<p style="color: grey">
Python
recipe 52265
by <a href="/recipes/users/11203/">Paul Prescod</a>
(<a href="/recipes/tags/files/">files</a>).
</p>
<p>Python can work directly with data in zip files. You can look at the
list of items in the directory and work with the data files themselves.</p>
Auto-detect XML encoding (Python)
2001-03-14T08:33:16-08:00Paul Prescodhttp://code.activestate.com/recipes/users/11203/http://code.activestate.com/recipes/52257-auto-detect-xml-encoding/
<p style="color: grey">
Python
recipe 52257
by <a href="/recipes/users/11203/">Paul Prescod</a>
(<a href="/recipes/tags/xml/">xml</a>).
</p>
<p>The XML specification describes the outlines of an algorithm for detecting the
Unicode encoding that an XML document uses. This function will do that.</p>
XML Lexing ("shallow parsing") (Python)
2001-06-13T21:24:21-07:00Paul Prescodhttp://code.activestate.com/recipes/users/11203/http://code.activestate.com/recipes/65125-xml-lexing-shallow-parsing/
<p style="color: grey">
Python
recipe 65125
by <a href="/recipes/users/11203/">Paul Prescod</a>
(<a href="/recipes/tags/xml/">xml</a>).
Revision 2.
</p>
<p>Sometimes you want to work more with the form of an XML document than with the structural information it contains. For instance if you wanted to change a bunch of entity references or element names. Also, sometimes you have slightly incorrect XML that a traditional parser will choke on. In that case you want an XML lexer or "shallow parser". This is a Python implementation.</p>
Check xml well-formedness (Python)
2001-06-14T19:41:15-07:00Paul Prescodhttp://code.activestate.com/recipes/users/11203/http://code.activestate.com/recipes/52256-check-xml-well-formedness/
<p style="color: grey">
Python
recipe 52256
by <a href="/recipes/users/11203/">Paul Prescod</a>
(<a href="/recipes/tags/xml/">xml</a>).
Revision 2.
</p>
<p>This small script will check whether one or more XML documents are well-formed.</p>
Extract text from XML document (Python)
2001-06-14T19:42:23-07:00Paul Prescodhttp://code.activestate.com/recipes/users/11203/http://code.activestate.com/recipes/65128-extract-text-from-xml-document/
<p style="color: grey">
Python
recipe 65128
by <a href="/recipes/users/11203/">Paul Prescod</a>
(<a href="/recipes/tags/xml/">xml</a>).
Revision 2.
</p>
<p>People often ask how to extract the text from an XML document. This small program does it.</p>
Count tags in a document (Python)
2001-06-13T02:30:27-07:00Paul Prescodhttp://code.activestate.com/recipes/users/11203/http://code.activestate.com/recipes/65127-count-tags-in-a-document/
<p style="color: grey">
Python
recipe 65127
by <a href="/recipes/users/11203/">Paul Prescod</a>
(<a href="/recipes/tags/xml/">xml</a>).
Revision 3.
</p>
<p>This is an example SAX application and can be used as the basis for any SAX application. It is somewhat useful in and of itself when you want to get a sense of the frequency of occurance of particular elements in XML.</p>