(string, handler, errorHandler=ErrorHandler())
| 33 | parser.parse(source) |
| 34 | |
| 35 | def parseString(string, handler, errorHandler=ErrorHandler()): |
| 36 | import io |
| 37 | if errorHandler is None: |
| 38 | errorHandler = ErrorHandler() |
| 39 | parser = make_parser() |
| 40 | parser.setContentHandler(handler) |
| 41 | parser.setErrorHandler(errorHandler) |
| 42 | |
| 43 | inpsrc = InputSource() |
| 44 | if isinstance(string, str): |
| 45 | inpsrc.setCharacterStream(io.StringIO(string)) |
| 46 | else: |
| 47 | inpsrc.setByteStream(io.BytesIO(string)) |
| 48 | parser.parse(inpsrc) |
| 49 | |
| 50 | # this is the parser list used by the make_parser function if no |
| 51 | # alternatives are given as parameters to the function |
searching dependent graphs…