[XML-SIG] Reader() newbie question
Uche Ogbuji
uogbuji@fourthought.com
Sun, 01 Jul 2001 23:56:47 -0600
> > p = make_parser("xml.sax.drivers.drv_xmlproc")
> > reader = Sax.Reader(parser=p)
>
> Sorry it took so long to get back to you. This works fine for me, Thanks.
> In my case since I want to use a validating parser I use:
>
> p = make_parser("xml.sax.drivers.drv_xmlproc_val")
> reader = Sax.Reader(parser=p)
Oops. Right.
> Since I can also write:
>
> p = make_parser("xml.sax.drivers.drv.pyexpat")
> reader = Sax.Reader(parser=p)
>
> what is considered the "correct" method if I want to use expat? The above
> line or what I have seen more often:
>
> reader = PyExpat.Reader()
>
> I mean, sure the second method is one line shorter, but the first one is
> consistent across all the parsers on my machine under 'xml.sax.drivers'
> Does the second method do important init stuff (or whatever) that I am
> missing?
Their both right, and equivalent, since PyXML sets up
"xml.sax.drivers.drv.pyexpat" as the default non-validating SAX driver.
--
Uche Ogbuji Principal Consultant
uche.ogbuji@fourthought.com +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management