XML beautifier?

Magnus L. Hetland mlh at idt.ntnu.no
Fri Sep 3 08:57:09 EDT 1999


earlybird at mop.no (Alexander Staubo) writes:

> In article <19990902191223.A29226 at sz-sb.de>, ajung at sz-sb.de says...
> > On Thu, Sep 02, 1999 at 05:29:40PM +0200, Alexander Staubo wrote:
> > > I'm having a gas with the XML package and its DOM classes, but its toxml
> > > () mechanism outputs mainly flat XML -- no visual structure in the form 
> > > of line shifts or indentation. Is there a Python module that such 
> > > beautification reasonably hassle-free?
> > 
> > Here is just a very stupid program which does the job. 
> 
> You're right. That was moronic. :)
> 
> >It works
> > with regular expressions. You can although use the sgmllib
> > to parse the file, find the tags with the unknown_starttag() and
> > unknown_endtag() functions and indent the output corresponding.
> 
> Thanks for the pointer, I'll check it out. Any examples of this though? 
> This is one module I have to say I have never touched.

Why not just use xmllib? (I mean - why sgmllib?)

> 
> > Cheers,
> > Andreas
> > ------------
> [silly code elided]
> 
> -- 
> Alexander Staubo             http://www.mop.no/~alex/
> "`Ford, you're turning into a penguin. Stop it.'"
> --Douglas Adams, _The Hitchhiker's Guide to the Galaxy_

-- 
--

  Magnus              Making no sound / Yet smouldering with passion
  Lie          The firefly is still sadder / Than the moaning insect
  Hetland                                       : Minamoto Shigeyuki




More information about the Python-list mailing list