Development Tools Python scripts - Top 4 Download

Development Tools Python script downloads

Parsing an XML file with xml parsers expat

This script shows you a reusable way to use "xml.parsers.expat" to parse an XML file. When re-using the "MyXML" class, all you need to define a new class, with "MyXML" as the parent. Once you have done that, all you have to do is overwrite the inherited XML handlers and you are ready ...
Python

Using the SAX2 LexicalHandler Interface

This code shows how to use the relatively unknown LexicalHandler interface, which is an extension to the standard SAX2 interfaces like ContentHandler. ...
Python

XML Lexing

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 ...
Python

Align XML ElementTrees with original text

Often when a program adds some XML markup to a plain-text document, it doesn't retain the original whitespace formatting. This script determines the character offsets the XML elements should have had in the original document. ...
Python

ElementTree Text Helper

This script solves the "tail-problem" for prose-oriented XML. It recursively pulls text out of elements and their sub-elements and extracts text from DocBook, XMHTL, and other nested XML markup. ...
Python

Support for the in operator

This script adds support for the "in" operator to the attributes map of minidom elements. When you parse XML using minidom, you can get a map of attributes for any element. The problem is that using the "in" operator on this map will raise an exception and this script will fix ...
Python

Multiple handlers for xml sax parser

SAX is commonly used on large XML files because they don't fit nicely into core memory necessary for the friendlier DOM API. When dealing with -really- large XML files, multiple passes over the file becomes costly. The SAX handler in this script allows you to handle an XML file multiple ways in ...
Python

Simple XML serlializer de serializer

This script presents a way of serializing & de-serializing XML using the marshal module. The XML is converted to an equivalent Python dictionary first, which is marshaled to serialize it. De-serialization first unmarshals the dictionary from the file, and constructs the original XML. ...
Python

XML as Dictionary

This script uses two simple classes to provide the mechanism for XML conversion. ...
Python

xmlreader

This script reads an xml file into a python dictionary of dictionaries (repeated elements are read in as lists). It works with repeating elements without having to specify the multiple attribute. ...
Python

A SAX filter for normalizing text events

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 ...
Python

MarkupString

This script contains a subclass of String that allows simple handling of simple XML markup. The goal here is to allow a slice of a python markup string to "do the right thing" and preserve formatting correctly. In other words, MarkupString(Hello World)[6:] = "World". ...
Python

mbsa2txt

This script allows you to read the Microsoft Baseline Security Analyzer 1.2.1 XML output and sends it to standard output in a readable text format. ...
Python

Remove whitespace from an XML DOM

When creating a DOM from an XML source, XML parsers are required to consider several conditions when deciding whether to include whitespace-only text nodes. This function ignores all of those conditions and removes all whitespace-only text descendants of the specified node. If the unlink flag is specified, the removed text nodes ...
Python

Ljopml

This is a Python script to generate the OPML feed of your LiveJournal Friends list. ...
Python

Extract text from XML document

This script represents an alternative way of extracting text from a WF XML source. ...
Python

Validating XML with External DTDs using xmlproc

PyXML is a useful package for parsing XML. The xmlval and xmldtd modules let you validate XML docs against an external DTD file. This is a simple, straightforward script that illustrates how to use the xmlval and xmldtd modules for validated XML parsing. ...
Python

Stopwatch in Tkinter

This script is a small implementation of a stopwatch widget in Tkinter. The widget displays a label with minutes:seconds:1/100-seconds. The label is updated every 50 ms, but that can easily be changed. Methods are availble for starting, stopping and resetting the stopwatch. ...
Python

change cvsroot

change_cvsroot  is a simple script written in Python that can switch a working copy of a CVS module (or modules) to another CVS root. ...
Python