Your IP : 18.188.211.246


Current Path : /opt/alt/python311/lib64/python3.11/xml/sax/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/xml/sax/__pycache__/expatreader.cpython-311.pyc

�

c��fS?��
�dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d	d
�dkredd	���[	dd
lmZeed��sedd	���n#e$r
edd	���wxYwddlmZmZmZejZejZ	dd	lZdd	lZejZ[[n#e$rd�ZYnwxYwGd�d��ZGd�dej��ZGd�dej ej��Z!d�Z"e#dkr�dd	l$Z%e"��Z&e&�'e%j(j�)����e&�*e%j(�+����e&�,d��d	Sd	S)z]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
z0.20�)�*)�feature_validation�feature_namespaces)�feature_namespace_prefixes)�feature_external_ges�feature_external_pes)�feature_string_interning)�property_xml_string�property_interning_dictN��javazexpat not available in Java)�expat�ParserCreatezexpat not supported)�	xmlreader�saxutils�handlerc��|S�N�)�os �:/opt/alt/python311/lib64/python3.11/xml/sax/expatreader.py�_mkproxyr's����c��eZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.s�������Drrc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�ExpatLocatorz�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    c�.�t|��|_dSr)r�_ref��self�parsers  r�__init__zExpatLocator.__init__9s���V�$�$��	�	�	rc�:�|j}|j�dS|jjSr)r"�_parser�ErrorColumnNumberr#s  r�getColumnNumberzExpatLocator.getColumnNumber<s!������>�!��4��~�/�/rc�:�|j}|j�dS|jjS�N�)r"r(�ErrorLineNumberr#s  r�
getLineNumberzExpatLocator.getLineNumberBs!������>�!��1��~�-�-rc�J�|j}|�dS|j���Sr)r"�_source�getPublicIdr#s  rr2zExpatLocator.getPublicIdH�'������>��4��~�)�)�+�+�+rc�J�|j}|�dS|j���Sr)r"r1�getSystemIdr#s  rr5zExpatLocator.getSystemIdNr3rN)	rrr�__doc__r&r*r/r2r5rrrr r 3si��������
%�%�%�0�0�0�.�.�.�,�,�,�,�,�,�,�,rr c���eZdZdZd&d�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd'd
�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Z d"�Z!d#�Z"d$�Z#d%S)(�ExpatParserz$SAX driver for the pyexpat C module.r��c���tj�||��tj��|_d|_||_d|_d|_g|_	d|_
d|_dS)NFr)r�IncrementalParserr&�InputSourcer1r(�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)r$�namespaceHandling�bufsizes   rr&zExpatParser.__init__Zsd���#�,�,�T�7�;�;�;� �,�.�.������,���!%�����
�����������rc�(�tj|��}||_	|���|j�t
|����tj�	||��dS#|�
���xYw)z3Parse an XML document from a URL or an InputSource.N)r�prepare_input_sourcer1�reset�
_cont_handler�setDocumentLocatorr rr;�parse�
_close_source�r$�sources  rrJzExpatParser.parsegs����.�v�6�6�����		��J�J�L�L�L���1�1�,�t�2D�2D�E�E�E��'�-�-�d�F�;�;�;�;�;��	�
��� � � ����s�AA:�:Bc��|����.|j�|�����dSdSr)r5r(�SetBaserLs  r�
prepareParserzExpatParser.prepareParserwsD�������+��L� � ��!3�!3�!5�!5�6�6�6�6�6�,�+rc��tj�||��|jr|���dSdSr)rr;�setContentHandlerr?�_reset_cont_handler)r$rs  rrRzExpatParser.setContentHandler}sG���#�5�5�d�G�D�D�D��=�	'��$�$�&�&�&�&�&�	'�	'rc���|tkr|jS|tkr	|jduS|tt
tfvrdS|tkr|jStd|z���)Nr�Feature '%s' not recognized)
rr=r	rBrrrrrA�SAXNotRecognizedException�r$�names  r�
getFeaturezExpatParser.getFeature�sy���%�%�%��#�#�
�-�
-�
-��?�$�.�.�
�(�*>�0�2�2�2��1�
�)�
)�
)��%�%�'�(E��(L�M�M�Mrc��|jrtd���|tkr	||_dS|tkr	||_dS|tkr|r|j�	i|_dSdSd|_dS|tkr|rtd���dS|tkr|rtd���dS|tkr|rtd���dStd|z���)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesrU)r?�SAXNotSupportedExceptionrr=rrAr	rBrrrrV)r$rX�states   r�
setFeaturezExpatParser.setFeature�sQ���=�	P�*�+N�O�O�O��%�%�%�$�D����
�)�
)�
)�!&�D����
�-�
-�
-��
'��?�*�&(�D�O�O�O�+�*�#'�����
�'�
'�
'��
9�.�7�9�9�9�
9�
9��)�
)�
)��
G�.�E�G�G�G�
G�
G��/�
/�
/��
@�.�>�@�@�@�
@�
@�,�-��4�6�6�
6rc�4�|tjkr|jS|tkr|jS|t
krS|jr=t|jd��r|j���Std���td���td|z���)N�GetInputContextz=This version of expat does not support getting the XML stringz.XML string cannot be returned when not parsing�Property '%s' not recognized)r�property_lexical_handlerr>rrBr
r(�hasattrr_rVr[rWs  r�getPropertyzExpatParser.getProperty�s����7�3�3�3��)�)�
�,�
,�
,��?�"�
�(�
(�
(��|�	
F��4�<�):�;�;�+��<�7�7�9�9�9�3�*�+�+�+�/�D�F�F�F�'�(F��(M�N�N�Nrc���|tjkr&||_|jr|���dSdS|t
kr	||_dS|tkrtd|z���td|z���)NzProperty '%s' cannot be setr`)
rrar>r?�_reset_lex_handler_proprrBr
r[rV)r$rX�values   r�setPropertyzExpatParser.setProperty�s����7�3�3�3�%*�D�"��}�
/��,�,�.�.�.�.�.�
/�
/�
�,�
,�
,�#�D�O�O�O�
�(�
(�
(�*�+H�+/�,0�1�1�
1�,�,J�,0�-1�2�2�
2rFc�r�|js4|���d|_|j���	|j�||��dS#tj$rM}tt
j	|j
��||��}|j�|��Yd}~dSd}~wwxYw)NT)
r?rGrH�
startDocumentr(�Parser�error�SAXParseException�ErrorString�code�_err_handler�
fatalError)r$�data�isFinal�e�excs     r�feedzExpatParser.feed�s����}�	/��J�J�L�L�L� �D�M���,�,�.�.�.�		.�

�L���t�W�-�-�-�-�-���{�	.�	.�	.�#�E�$5�a�f�$=�$=�q�$�G�G�C���(�(��-�-�-�-�-�-�-�-�-�����	.���s�A�B6�)AB1�1B6c���|j�dS|j���}	|j�d��|j�dd��n^#tj$rL}t
t	j|j��||��}|j	�
|��Yd}~nd}~wwxYw|j�|��dS#|j�|��wxYw)NFr)r(�GetReparseDeferralEnabled�SetReparseDeferralEnabledrjrrkrlrmrnrorp)r$�was_enabledrsrts    r�flushzExpatParser.flush�s����<���F��l�<�<�>�>��	@��L�2�2�5�9�9�9��L���s�E�*�*�*�*���{�	.�	.�	.�#�E�$5�a�f�$=�$=�q�$�G�G�C���(�(��-�-�-�-�-�-�-�-�����	.����
�L�2�2�;�?�?�?�?�?��D�L�2�2�;�?�?�?�?���s0�5A�C�B5�)AB0�+C�0B5�5C�C0c�"�|j}	|���}|�|���|���}|�|���dSdS#|���}|�|���wwxYwr)r1�getCharacterStream�close�
getByteStream)r$rM�files   rrKzExpatParser._close_source�s������	��,�,�.�.�D����
�
�����'�'�)�)�D����
�
������ ����'�'�)�)�D����
�
����� ���s�*A!�!-Bc�F�|js!|j�t|jt��rdS	|�dd���|j���d|_d|_d|_|j�7t��}|jj|_|jj	|_	||_|�
��dS#d|_|j�7t��}|jj|_|jj	|_	||_|�
��wxYw)NrT)rrF)r@r(�
isinstancerrurH�endDocumentr?r)r.rKr#s  rr}zExpatParser.close�s����	�$�,�"6��t�|�]�3�3�#7�
�F�	!��I�I�c�4�I�(�(�(���*�*�,�,�,�!�D�M��D�L�!�D�M��|�'�&����+/�<�+I��(�)-��)E��&�%������ � � � � ��"�D�M��|�'�&����+/�<�+I��(�)-��)E��&�%������ � � � ���s�>C�AD c�^�|jj|j_|jj|j_dSr)rH�processingInstructionr(�ProcessingInstructionHandler�
characters�CharacterDataHandler�r$s rrSzExpatParser._reset_cont_handler
s+��$(�$6�$L�	
��1�,0�,>�,I���)�)�)rc���|j}|j}|�%d|_d|_d|_d|_d|_dS|j|_|j|_|j	|_|j
|_|j|_dSr)r>r(�CommentHandler�StartCdataSectionHandler�EndCdataSectionHandler�StartDoctypeDeclHandler�EndDoctypeDeclHandler�comment�
startCDATA�endCDATA�start_doctype_decl�endDTD)r$�lexr%s   rrez#ExpatParser._reset_lex_handler_props}���$������;�$(�F�!�.2�F�+�,0�F�)�-1�F�*�+/�F�(�(�(�$'�K�F�!�.1�n�F�+�,/�L�F�)�-1�-D�F�*�+.�:�F�(�(�(rc�T�|jrgtj|j���d|j���|_d|j_|j|j_	|j
|j_nYtj|j���|j���|_|j|j_	|j
|j_|���|j|j_|j|j_|j|j_|j|j_d|_|jr|���|j|j_	|j|j_n#t<$rYnwxYw|j�tj ��d|_!g|_"dS)N� )�internr-F)#r=rrr1�getEncodingrBr(�namespace_prefixes�start_element_ns�StartElementHandler�end_element_ns�EndElementHandler�
start_element�end_elementrS�unparsed_entity_decl�UnparsedEntityDeclHandler�
notation_decl�NotationDeclHandler�start_namespace_decl�StartNamespaceDeclHandler�end_namespace_decl�EndNamespaceDeclHandler�_decl_handler_propr>re�external_entity_ref�ExternalEntityRefHandler�skipped_entity_handler�SkippedEntityHandler�AttributeError�SetParamEntityParsing�*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr?r@r�s rrGzExpatParser.reset"s�����
	>� �-�d�l�.F�.F�.H�.H�#�59�_�F�F�F�D�L�./�D�L�+�/3�/D�D�L�,�-1�-@�D�L�*�*� �-�d�l�.F�.F�.H�.H�7;��H�H�H�D�L�/3�/A�D�L�,�-1�-=�D�L�*�� � �"�"�"�15�1J���.�+/�+=���(�15�1J���.�/3�/F���,�"&����!�	+��(�(�*�*�*�15�0H���-�	�04�0K�D�L�-�-���	�	�	��D�	����	
��*�*��<�	>�	>�	>���
�����s�E&�&
E3�2E3c�,�|j�dS|jjSr)r(r)r�s rr*zExpatParser.getColumnNumberIs���<���4��|�-�-rc�,�|j�dS|jjSr,)r(r.r�s rr/zExpatParser.getLineNumberNs���<���1��|�+�+rc�4�|j���Sr)r1r2r�s rr2zExpatParser.getPublicIdS����|�'�'�)�)�)rc�4�|j���Sr)r1r5r�s rr5zExpatParser.getSystemIdVr�rc�V�|j�|t|����dSr)rH�startElement�AttributesImpl)r$rX�attrss   rr�zExpatParser.start_elementZs)����'�'��n�U�.C�.C�D�D�D�D�Drc�:�|j�|��dSr)rH�
endElementrWs  rr�zExpatParser.end_element]�����%�%�d�+�+�+�+�+rc�J�|���}t|��dkrd|f}n3t|��dkr|d|df}nt|��}i}i}|���D]�\}}|���}t|��}	|	dkr|}
d|f}nA|	dkr$|d�d|d��}
|d|df}n|d}
t|��}|||<|
||<��|j�|dt
||����dS)Nr-�r��:)�split�len�tuple�itemsrH�startElementNS�AttributesNSImpl)r$rXr��pair�newattrs�qnames�anamerf�parts�length�qname�apairs            rr�zExpatParser.start_element_ns`sI���z�z�|�|���t�9�9��>�>��$�<�D�D�
��Y�Y�!�^�^���7�D��G�#�D�D���;�;�D�����#�k�k�m�m�	"�	"�N�U�E��K�K�M�M�E���Z�Z�F���{�{����u�
����1���#(��8�8�8�U�1�X�X�6���a��%��(�*����a����e����#�H�U�O�!�F�5�M�M���)�)�$��*:�8�V�*L�*L�	N�	N�	N�	N�	Nrc��|���}t|��dkrd|f}n3t|��dkr|d|df}nt|��}|j�|d��dS)Nr-r�r)r�r�r�rH�endElementNS)r$rXr�s   rr�zExpatParser.end_element_ns�sv���z�z�|�|���t�9�9��>�>��$�<�D�D�
��Y�Y�!�^�^���7�D��G�#�D�D���;�;�D���'�'��d�3�3�3�3�3rc�<�|j�||��dSr)rHr�)r$�targetrqs   r�processing_instructionz"ExpatParser.processing_instruction�s!����0�0���>�>�>�>�>rc�:�|j�|��dSr)rHr�)r$rqs  r�character_datazExpatParser.character_data�r�rc�<�|j�||��dSr)rH�startPrefixMapping)r$�prefix�uris   rr�z ExpatParser.start_namespace_decl�s!����-�-�f�c�:�:�:�:�:rc�:�|j�|��dSr)rH�endPrefixMapping)r$r�s  rr�zExpatParser.end_namespace_decl�s����+�+�F�3�3�3�3�3rc�>�|j�|||��dSr)r>�startDTD)r$rX�sysid�pubid�has_internal_subsets     rr�zExpatParser.start_doctype_decl�s#����'�'��e�U�;�;�;�;�;rc�@�|j�||||��dSr)�_dtd_handler�unparsedEntityDecl)r$rX�baser�r��
notation_names      rr�z ExpatParser.unparsed_entity_decl�s%����,�,�T�5�%��O�O�O�O�Orc�>�|j�|||��dSr)r��notationDecl)r$rXr�r�r�s     rr�zExpatParser.notation_decl�s#����&�&�t�U�E�:�:�:�:�:rc���|jsdS|j�||��}tj||j���pd��}|j�|j	|jf��|j	�
|��|_	||_	tj�
||��n#YdSxYw|jd\|_	|_|jd=dS)Nr-�r���)rA�_ent_handler�
resolveEntityrrFr1r5r@�appendr(�ExternalEntityParserCreaterr;rJ)r$�contextr�r�r�rMs      rr�zExpatParser.external_entity_ref�s����!�	��1��"�0�0���>�>���.�v�/3�|�/G�/G�/I�/I�02�/1�3�3��	
��!�!�4�<���">�?�?�?��|�>�>�w�G�G������	��'�-�-�d�F�;�;�;�;��	��1�1����'+�'9�"�'=�$���t�|���r�"��qs�  C�Cc�H�|rd|z}|j�|��dS)N�%)rH�
skippedEntity)r$rX�is_pes   rr�z"ExpatParser.skipped_entity_handler�s0���	��t�8�D���(�(��.�.�.�.�.rN)rr9)F)$rrrr6r&rJrPrRrYr]rcrgrurzrKr}rSrerGr*r/r2r5r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr8r8Ws������.�.�	�	�	�	���� 7�7�7�'�'�'�

N�
N�
N�6�6�6�<O�O�O�$2�2�2� .�.�.�.�"@�@�@�	�	�	�!�!�!�*J�J�J�
6�6�6� # �# �# �N.�.�.�
,�,�,�
*�*�*�*�*�*�E�E�E�,�,�,� N� N� N�D	4�	4�	4�?�?�?�,�,�,�;�;�;�4�4�4�<�<�<�P�P�P�;�;�;����,/�/�/�/�/rr8c��t|i|��Sr)r8)�args�kwargss  r�
create_parserr��s����'��'�'�'r�__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml)-r6�version�xml.sax._exceptions�xml.sax.handlerrrrrrr	r
r�sys�platform�SAXReaderNotAvailable�xml.parsersrrb�ImportError�xml.saxrrrr�r��_weakref�weakref�proxyrr�Locatorr r;r8r�r�xml.sax.saxutils�xml�prR�sax�XMLGenerator�setErrorHandler�ErrorHandlerrJrrr�<module>rs�����
��!�!�!�!�B�B�B�B�B�B�B�B�6�6�6�6�6�6�F�F�F�F�F�F�F�F�4�4�4�4�4�4�H�H�H�H�H�H�H�H��
�
�
��<�����v���
�
� =�t�
D�
D�D��A�!�!�!�!�!�!��7�5�.�)�)�A�#�#�$9�4�@�@�@�A���=�=�=�
�
� 5�t�
<�
<�<�=����
1�0�0�0�0�0�0�0�0�0��)���-��
��O�O�O�
�N�N�N��}�H�����
�������������	�	�	�	�	�	�	�	�
,�,�,�,�,�9�$�,�,�,�Hg/�g/�g/�g/�g/�)�-�y�/@�g/�g/�g/�V(�(�(�
�z��������
���A������(�5�5�7�7�8�8�8����c�g�*�*�,�,�-�-�-��G�G�H�I�I�I�I�I��s�A1�1B�B1�1B<�;B<

?>