U e5d?ã@s dZddlmZddlmZmZddlmZmZm Z m Z m Z eƒfdd„Z eƒfdd„Z d gZd Zernd d lZd d lZd d lZejjs d ejkr ejd  d ¡Z[dZejd d…dkrÖej e¡rÖej e¡ d ¡Zddd„Zejd d…dkrüdd„Zndd„Z[d S)aÛSimple API for XML (SAX) implementation for Python. This module provides an implementation of the SAX 2 interface; information about the Java version of the interface can be found at http://www.megginson.com/SAX/. The Python version of the interface is documented at <...>. This package contains the following modules: handler -- Base classes and constants which define the SAX 2 API for the 'client-side' of SAX for Python. saxutils -- Implementation of the convenience classes commonly used to work with SAX. xmlreader -- Base classes and constants which define the SAX 2 API for the parsers used with SAX for Python. expatreader -- Driver that allows use of the Expat parser with SAX. é)Ú InputSource)ÚContentHandlerÚ ErrorHandler)Ú SAXExceptionÚSAXNotRecognizedExceptionÚSAXParseExceptionÚSAXNotSupportedExceptionÚSAXReaderNotAvailablecCs(tƒ}| |¡| |¡| |¡dS)N)Ú make_parserÚsetContentHandlerÚsetErrorHandlerÚparse)ÚsourceÚhandlerÚ errorHandlerÚparser©rú(/usr/lib64/python3.8/xml/sax/__init__.pyr s  r cCspddl}|dkrtƒ}tƒ}| |¡| |¡tƒ}t|tƒrR| |  |¡¡n|  |  |¡¡|  |¡dS)Né) Úiorr r r rÚ isinstanceÚstrZsetCharacterStreamÚStringIOZ setByteStreamÚBytesIOr )ÚstringrrrrZinpsrcrrrÚ parseString#s   rzxml.sax.expatreaderrNZ PY_SAX_PARSERú,zpython.xml.sax.parseréÚjavarc Csxt|ƒtD]\}zt|ƒWStk rT}zddl}||jkrD‚W5d}~XYq tk rfYq Xq tddƒ‚dS)a3Creates and returns a SAX parser. Creates the first parser it is able to instantiate of the ones given in the iterable created by chaining parser_list and default_parser_list. The iterables must contain the names of Python modules containing both a SAX parser and a create_parser function.rNzNo parsers found)ÚlistÚdefault_parser_listÚ_create_parserÚ ImportErrorÚsysÚmodulesr )Z parser_listÚ parser_nameÚer#rrrr Fs r cCs$ddlm}| |dtƒ¡}| ¡S)Nr)Úimp)Zorg.python.corer'Z importNameÚglobalsÚ create_parser)r%r'Ú drv_modulerrrr!as r!cCst|iidgƒ}| ¡S)Nr))Ú __import__r))r%r*rrrr!gs)r)Ú__doc__Z xmlreaderrrrrÚ _exceptionsrrrrr r rr Ú_falseZxml.sax.expatreaderZxmlÚosr#ÚflagsÚignore_environmentÚenvironÚsplitZ_keyÚplatformÚregistryZ containsKeyZ getPropertyr r!rrrrÚs*