[XML-SIG] FromXml question

Martin v. Loewis martin@v.loewis.de
Sun, 28 Oct 2001 19:16:07 +0100


> I just downloaded the new PyXML tutorial about DOM from IBM's developerworks
> and read, that 
> FromXmlStream
> FromXml
> FromXmlFile
> FromXmlUrl
> 
> are the main functions for parsing.
> but when I look at the source code of Sax2.py
> these functions are marked 
> "Deprecated "
> 
> but I can not find another place where these functions are defined.
> can somebody tell me if the tutorial is out of date or if these are still
> the right functions to use??

Neither, nor. The functions are still working, and their location
hasn't changed; the code in the tutorial works absolutely fine.

However, the 4DOM author want you to use a class-based API instead of
these convenience functions; i.e. you should instantiate a Sax2.Reader
object (passing a parser if desired), configure the reader, then
invoke the reader's From* methods.

The new reader interface is more flexible, since you can add a new
functionality (e.g. additional parametrization) to the base reader
class, and it will become available to all derived classes. The
deprecated status just means that such new functionality won't be
exposed through the wrapper functions.

It is inherently difficult to predict the future, so I cannot say when
these functions will be removed. Possibly, the entire reader structure
will be replaced with DOM 3 load/store interface one day, removing the
need for xml.dom.ext. Even at that time, the extensions are likely to
stay as long as existing applications use it.

Regards,
Martin