AlkantarClanX12

Your IP : 3.145.59.89


Current Path : /opt/alt/python39/lib64/python3.9/xml/sax/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/xml/sax/__pycache__/expatreader.cpython-39.opt-2.pyc

a

R�fS?�@s�dZddlTddlmZmZddlmZddlmZmZddlmZddlm	Z	m
Z
ddlZejdd	�d
krxe
dd��[zddlmZWney�e
d
d��Yn0eed�s�e
d
d��ddlmZmZmZejZejZzddlZWne�ydd�ZYn0ddlZejZ[[Gdd�d�ZGdd�dej�ZGdd�dejej�Z dd�Z!e"dk�r�ddl#Z$e!�Z%e%�&e$j'j�(��e%�)e$j'�*��e%�+d�dS)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)�expatzexpat not supported�ParserCreate)�	xmlreader�saxutils�handlercCs|S�N�)�orr�8/opt/alt/python39/lib64/python3.9/xml/sax/expatreader.py�_mkproxy'src@seZdZdS)�
_ClosedParserN)�__name__�
__module__�__qualname__rrrrr.src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�ExpatLocatorcCst|�|_dSr)r�_ref��self�parserrrr�__init__9szExpatLocator.__init__cCs|j}|jdurdS|jjSr)r�_parser�ErrorColumnNumberrrrr�getColumnNumber<s
zExpatLocator.getColumnNumbercCs|j}|jdurdS|jjS�N�)rr!�ErrorLineNumberrrrr�
getLineNumberBs
zExpatLocator.getLineNumbercCs|j}|durdS|j��Sr)r�_source�getPublicIdrrrrr)HszExpatLocator.getPublicIdcCs|j}|durdS|j��Sr)rr(�getSystemIdrrrrr*NszExpatLocator.getSystemIdN)rrrr r#r'r)r*rrrrr3s
rc@seZdZdEdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dFdd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDS)G�ExpatParserr��cCsFtj�||�t��|_d|_||_d|_d|_g|_	d|_
d|_dS)NFr)r�IncrementalParserr ZInputSourcer(r!�_namespaces�_lex_handler_prop�_parsing�
_entity_stack�
_external_ges�
_interning)rZnamespaceHandling�bufsizerrrr Zs
zExpatParser.__init__cCsVt�|�}||_z*|��|j�t|��tj�	||�Wn|�
��Yn0dSr)r�prepare_input_sourcer(�reset�
_cont_handlerZsetDocumentLocatorrrr-�parse�
_close_source�r�sourcerrrr8gs
zExpatParser.parsecCs |��dur|j�|���dSr)r*r!ZSetBaser:rrr�
prepareParserwszExpatParser.prepareParsercCs tj�||�|jr|��dSr)rr-�setContentHandlerr0�_reset_cont_handler)rrrrrr=}szExpatParser.setContentHandlercCsP|tkr|jS|tkr |jduS|tttfvr2dS|tkr@|jSt	d|��dS)Nr�Feature '%s' not recognized)
rr.rr3rrrrr2�SAXNotRecognizedException�r�namerrr�
getFeature�s
�zExpatParser.getFeaturecCs�|jrtd��|tkr||_n�|tkr.||_nt|tkrT|rL|jdurRi|_q�d|_nN|tkrj|r�td��n8|t	kr�|r�td��n"|t
kr�|r�td��ntd|��dS)Nz!Cannot set features while parsingz!expat does not support validationz/expat does not read external parameter entitiesz(expat does not report namespace prefixesr?)r0�SAXNotSupportedExceptionrr.rr2rr3rrrr@)rrB�staterrr�
setFeature�s:
����zExpatParser.setFeaturecCsd|tjkr|jS|tkr|jS|tkrT|jrLt|jd�rB|j��St	d��nt
d��t	d|��dS)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/r
r3r	r!�hasattrrGr@rDrArrr�getProperty�s

��zExpatParser.getPropertycCsV|tjkr ||_|jrR|��n2|tkr0||_n"|tkrFtd|��nt	d|��dS)NzProperty '%s' cannot be setrH)
rrIr/r0�_reset_lex_handler_propr
r3r	rDr@)rrB�valuerrr�setProperty�s

��zExpatParser.setPropertyFc
Cs||js|��d|_|j��z|j�||�WnFtjyv}z,tt�	|j
�||�}|j�|�WYd}~n
d}~00dS)NT)
r0r6r7Z
startDocumentr!�Parser
�error�SAXParseException�ErrorString�code�_err_handler�
fatalError)r�data�isFinal�e�excrrr�feed�s
zExpatParser.feedc
Cs�|jdurdS|j��}zvz|j�d�|j�dd�WnFtjy~}z,tt�|j�||�}|j	�
|�WYd}~n
d}~00W|j�|�n|j�|�0dS)NF�)r!ZGetReparseDeferralEnabledZSetReparseDeferralEnabledrOr
rPrQrRrSrTrU)rZwas_enabledrXrYrrr�flush�s

$zExpatParser.flushcCsZ|j}z4|��}|dur |��W|��}|durV|��n|��}|durT|��0dSr)r(ZgetCharacterStream�closeZ
getByteStream)rr;�filerrrr9�s

�zExpatParser._close_sourcecCs�|js|jdust|jt�r dSz`|jddd�|j��d|_d|_Wd|_|jdurxt�}|jj|_|jj	|_	||_|�
�n:d|_|jdur�t�}|jj|_|jj	|_	||_|�
�0dS)Nr[T)rWF)r1r!�
isinstancerrZr7ZendDocumentr0r"r&r9rrrrr]�s.
�




�


zExpatParser.closecCs|jj|j_|jj|j_dSr)r7�processingInstructionr!ZProcessingInstructionHandler�
charactersZCharacterDataHandler�rrrrr>
s�zExpatParser._reset_cont_handlercCs`|j}|j}|dur4d|_d|_d|_d|_d|_n(|j|_|j|_|j	|_|j
|_|j|_dSr)r/r!ZCommentHandlerZStartCdataSectionHandlerZEndCdataSectionHandlerZStartDoctypeDeclHandlerZEndDoctypeDeclHandlerZcommentZ
startCDATAZendCDATA�start_doctype_declZendDTD)rZlexrrrrrLsz#ExpatParser._reset_lex_handler_propcCs�|jr>tj|j��d|jd�|_d|j_|j|j_	|j
|j_n,tj|j��|jd�|_|j|j_	|j
|j_|��|j|j_|j|j_|j|j_|j|j_d|_|jr�|��|j|j_z|j|j_Wnty�Yn0|j�tj �d|_!g|_"dS)N� )�internr%F)#r.r
rr(ZgetEncodingr3r!Znamespace_prefixes�start_element_nsZStartElementHandler�end_element_nsZEndElementHandler�
start_element�end_elementr>�unparsed_entity_declZUnparsedEntityDeclHandler�
notation_declZNotationDeclHandler�start_namespace_declZStartNamespaceDeclHandler�end_namespace_declZEndNamespaceDeclHandlerZ_decl_handler_propr/rL�external_entity_refZExternalEntityRefHandler�skipped_entity_handlerZSkippedEntityHandler�AttributeErrorZSetParamEntityParsingZ*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONEr0r1rbrrrr6"s<�
�






�zExpatParser.resetcCs|jdurdS|jjSr)r!r"rbrrrr#Is
zExpatParser.getColumnNumbercCs|jdurdS|jjSr$)r!r&rbrrrr'Ns
zExpatParser.getLineNumbercCs
|j��Sr)r(r)rbrrrr)SszExpatParser.getPublicIdcCs
|j��Sr)r(r*rbrrrr*VszExpatParser.getSystemIdcCs|j�|t|��dSr)r7ZstartElement�AttributesImpl)rrB�attrsrrrrhZszExpatParser.start_elementcCs|j�|�dSr)r7Z
endElementrArrrri]szExpatParser.end_elementcCs�|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}i}i}|��D]|\}}|��}t|�}	|	dkr�|}
d|f}n>|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<qT|j�|dt||��dS)Nr%�rz%s:%s�)�split�len�tuple�itemsr7ZstartElementNS�AttributesNSImpl)rrBrr�pairZnewattrsZqnamesZanamerM�partsZlengthZqnameZapairrrrrf`s0



�zExpatParser.start_element_nscCsV|��}t|�dkrd|f}n&t|�dkr<|d|df}nt|�}|j�|d�dS)Nr%rsr)rurvrwr7ZendElementNS)rrBrzrrrrg�s
zExpatParser.end_element_nscCs|j�||�dSr)r7r`)r�targetrVrrr�processing_instruction�sz"ExpatParser.processing_instructioncCs|j�|�dSr)r7ra)rrVrrr�character_data�szExpatParser.character_datacCs|j�||�dSr)r7ZstartPrefixMapping)r�prefixZurirrrrl�sz ExpatParser.start_namespace_declcCs|j�|�dSr)r7ZendPrefixMapping)rrrrrrm�szExpatParser.end_namespace_declcCs|j�|||�dSr)r/ZstartDTD)rrB�sysid�pubidZhas_internal_subsetrrrrc�szExpatParser.start_doctype_declcCs|j�||||�dSr)�_dtd_handlerZunparsedEntityDecl)rrB�baser�r�Z
notation_namerrrrj�sz ExpatParser.unparsed_entity_declcCs|j�|||�dSr)r�ZnotationDecl)rrBr�r�r�rrrrk�szExpatParser.notation_declcCs�|js
dS|j�||�}t�||j��p*d�}|j�|j	|jf�|j	�
|�|_	||_ztj�
||�WnYdS0|jd\|_	|_|jd=dS)Nr%�r���)r2Z_ent_handlerZ
resolveEntityrr5r(r*r1�appendr!ZExternalEntityParserCreaterr-r8)r�contextr�r�r�r;rrrrn�s"
�zExpatParser.external_entity_refcCs|rd|}|j�|�dS)N�%)r7Z
skippedEntity)rrBZis_perrrro�sz"ExpatParser.skipped_entity_handlerN)rr,)F)#rrrr r8r<r=rCrFrKrNrZr\r9r]r>rLr6r#r'r)r*rhrirfrgr}r~rlrmrcrjrkrnrorrrrr+Ws@


'"r+cOst|i|��Sr)r+)�args�kwargsrrr�
create_parser�sr��__main__z:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml),�versionZxml.sax._exceptionsZxml.sax.handlerrrrrrrr	r
�sys�platformZSAXReaderNotAvailableZxml.parsersr
�ImportErrorrJZxml.saxrrrrqry�_weakrefr�weakref�proxyrZLocatorrr-r+r�rZxml.sax.saxutilsZxml�pr=ZsaxZXMLGeneratorZsetErrorHandlerZErrorHandlerr8rrrr�<module>sL


$m