Пример #1
0
def parseString(string, handler, errorHandler=ErrorHandler()):
    from io import BytesIO
    if errorHandler is None:
        errorHandler = ErrorHandler()
    parser = make_parser()
    parser.setContentHandler(handler)
    parser.setErrorHandler(errorHandler)
    inpsrc = InputSource()
    inpsrc.setByteStream(BytesIO(string))
    parser.parse(inpsrc)
Пример #2
0
def parseString(string, handler, errorHandler=ErrorHandler()):
    from io import BytesIO
    if errorHandler is None:
        errorHandler = ErrorHandler()
    parser = make_parser()
    parser.setContentHandler(handler)
    parser.setErrorHandler(errorHandler)
    inpsrc = InputSource()
    inpsrc.setByteStream(BytesIO(string))
    parser.parse(inpsrc)
Пример #3
0
def parseString(string, handler, errorHandler = ErrorHandler()):
    try:
        from cStringIO import StringIO
    except ImportError:
        from StringIO import StringIO

    if errorHandler is None:
        errorHandler = ErrorHandler()
    parser = make_parser()
    parser.setContentHandler(handler)
    parser.setErrorHandler(errorHandler)
    inpsrc = InputSource()
    inpsrc.setByteStream(StringIO(string))
    parser.parse(inpsrc)
Пример #4
0
"""Simple API for XML (SAX) implementation for Python.