[Tutor] Pretty XML

Frank Moore francis.moore at rawflow.com
Wed Nov 23 17:54:20 CET 2005

Greg Lindstrom wrote:

> Hello-
> I am in the process of creating an XML document from information 
> stored in our database.  One of my colleagues will use the record to 
> format our information (health care claims) into all sorts of forms, 
> reports, etc.  He is partial to PHP5 but I like Python and would like 
> to know if there is something that would read in my XML file and 
> format it in a similar manner to "pretty print" so I can verify the 
> correct information is being pulled.  I have looked into the XML 
> documentation and, to be honest, I am overwhelmed with the choices; 
> SAX, DOM, XPath, 4Suite, and more.  Though I've been coding full time 
> for 25 years, I'm new to XML and could use some pointers.
> My immediate concern is to read in an XML stream from a file and 
> format it with indentation so that I can read and verify the data 
> against out database.  My long term concern is what tool(s) do you 
> think would give the biggest return against the effort required to 
> learn them?  The claim files I am generating will be less than a meg 
> each, if that matters.

Googling found the following Python/SAX XML indenter:


It should do what you want or at least give you a head start.


More information about the Tutor mailing list