import xml.sax.handler
import types
-try:
- _StringTypes = [types.StringType, types.UnicodeType]
-except AttributeError:
- _StringTypes = [types.StringType]
-
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
def parse(stream_or_string, parser=None, bufsize=None):
if bufsize is None:
bufsize = default_bufsize
- if type(stream_or_string) in _StringTypes:
+ if isinstance(stream_or_string, basestring):
stream = open(stream_or_string)
else:
stream = stream_or_string