XML namespaces and xmllib

Ian Oeschger oeschger at netscape.com
Fri May 26 04:24:59 CEST 2000


I don't seem to be able to turn off the namespacing support in xmllib so
I can just get the unnamespaced elements and attributes.
__use_namespaces, which looked like a likely place to start, gets reset
as soon as I actually start parsing data, so something like this doesn't
do anything for me:

class XP(xmllib.XMLParser):
 def unknown_starttag(self, t, a):
  print t
  print a

 def syntax_error(self, message):
  pass


p = XP()
p.__use_namespaces = 0
...
p.feed(data)

Nor does trying to set it within the event handler (e.g.,
self.__use_namespaces = 0). Maybe I'm overlooking
something obvious here. Is there some way tohandle this w/o
hand-stripping the namespace?

Thanks a lot
Ian Oeschger



--
Ian Oeschger
Principal Writer, Netscape





More information about the Python-list mailing list