xml.* getting the hang...

Martin v. Löwis loewis at informatik.hu-berlin.de
Sun Jun 9 07:00:39 EDT 2002


Uwe Mayer <merkosh at hadiko.de> writes:


First you write

> i figured that xml.sax and xml.parsers.expat is where to look for. 
> problem number first:

and then

> - in order to build an xml dom object i have to get started on a 
> Document(); 

If you want to build a DOM, I recommend not to use sax or expat
directly. Instead, you should use the minidom build,
xml.parse.minidom.parse.

> and this is the problem: i couldn't find anything; with one
> exception, i can create xml documents using
> xml.dom.minidom.Document(), if this is the regular case then i don't
> quite see how xml.sax.* and xml.dom.minidom relate to eachother.

They relate to each other through xml.dom.minidom.parse, which uses
xml.dom.pulldom.parse, which either uses the parser given as a
parameter, or uses xml.sax.make_parser, which either uses a parser
specified in an environment variable, or uses xml.sax.expatreader,
which uses xml.parsers.expat.

> Secondly i found the package xml.dom.pulldom which seems to be just what 
> i'm looking for, however the documentation is very poor on these classe. 
> what, f.e. is a "documentFactory"?

pulldom was originally not designed for "public" use, so I recommend
you ignore it.

> I don't want to do xml validating, so xml.parsers.expat could be used, 
> too. So now i don't know what to use at all:

You should use xml.dom.minidom.parse.

Regards,
Martin



More information about the Python-list mailing list