[xml] Python and Error Handling

In my python code I parse an xml document using:

import libxml2
body = libxml2.parseDoc(text)

Now at one point I don't want any errors logged to stderr so I do:
libxml2.registerErrorHandler(None, "")
body = libxml2.parseDoc(text)

Now what I can't figure out is once I have done that how do I turn
error logging back on?

Something like: libxml2.resetErrorHandler()
or: libxml2.registerErrorHandler(libxml2.defaultErrorHandler)

Nathan Bullock

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]