HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/lib64/python3.9/site-packages/__pycache__/drv_libxml2.cpython-39.pyc
a

�^�;�@sdZdZdZddlZddlZejddkrXe�e�dZeefZ	e�
d�dZdd	�ZneZ	d
d	�Zddl
TddlmZmZdd
lmZmZmZmZmZmZmZmZmZmZzddlZWn&ey�ede��d��Yn0Gdd�dej �Z Gdd�dej!�Z"dd�Z#dS)a� A SAX2 driver for libxml2, on top of it's XmlReader API

USAGE
    # put this file (drv_libxml2.py) in PYTHONPATH
    import xml.sax
    reader = xml.sax.make_parser(["drv_libxml2"])
    # ...and the rest is standard python sax.

CAVEATS
    - Lexical handlers are supported, except for start/endEntity
      (waiting for XmlReader.ResolveEntity) and start/endDTD
    - Error callbacks are not exactly synchronous, they tend
      to be invoked before the corresponding content callback,
      because the underlying reader interface parses
      data by chunks of 512 bytes
    
TODO
    - search for TODO
    - some ErrorHandler events (warning)
    - some ContentHandler events (setDocumentLocator, skippedEntity)
    - EntityResolver (using libxml2.?)
    - DTDHandler (if/when libxml2 exposes such node types)
    - DeclHandler (if/when libxml2 exposes such node types)
    - property_xml_string?
    - feature_string_interning?
    - Incremental parser
    - additional performance tuning:
      - one might cache callbacks to avoid some name lookups
      - one might implement a smarter way to pass attributes to startElement
        (some kind of lazy evaluation?)
      - there might be room for improvement in start/endPrefixMapping
      - other?

u Stéphane Bidoul <sbi@skynet.be>z0.3�N��utf8�cCs|dur|St|�dSdS)Nr)�_decoder��s�r�1/usr/lib64/python3.9/site-packages/drv_libxml2.py�_d1sr
cCs|S�Nrrrrr	r
9s)�*)�	xmlreader�saxutils)
�feature_namespaces�feature_namespace_prefixes�feature_string_interning�feature_validation�feature_external_ges�feature_external_pes�property_lexical_handler�property_declaration_handler�property_dom_node�property_xml_stringz+libxml2 not available: import error was: %sc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�Locatorz4SAX Locator adapter for libxml2.xmlTextReaderLocatorcCs
||_dSr)�_Locator__locator)�self�locatorrrr	�__init__SszLocator.__init__cCsdS)z6Return the column number where the current event ends.���r�rrrr	�getColumnNumberVszLocator.getColumnNumbercCs
|j��S)z4Return the line number where the current event ends.)rZ
LineNumberrrrr	�
getLineNumberZszLocator.getLineNumbercCsdS)z3Return the public identifier for the current event.Nrrrrr	�getPublicId^szLocator.getPublicIdcCs
|j��S)z3Return the system identifier for the current event.)rZBaseURIrrrr	�getSystemIdbszLocator.getSystemIdN)	�__name__�
__module__�__qualname__�__doc__rr r!r"r#rrrr	rPsrc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�
LibXml2ReadercCs@tj�|�d|_d|_d|_d|_d|_d|_d|_	d|_
dS)Nrr)r
�	XMLReaderr�_LibXml2Reader__ns�_LibXml2Reader__nspfx�_LibXml2Reader__validate�_LibXml2Reader__extparams�_LibXml2Reader__parsing�_LibXml2Reader__lex_handler�_LibXml2Reader__decl_handler�_LibXml2Reader__errorsrrrr	rhszLibXml2Reader.__init__cCs0|jdurg|_|j�|t|dt|��f�dSr)r1�appendZSAXParseExceptionr)r�arg�msg�severityrrrr	�
_errorHandlerws
��zLibXml2Reader._errorHandlercCsh|jD]V\}}|tjtjfvr,|j�|�q|rP||jddurP|j�|�q|j�|�qd|_dS)Nrr)r1�libxml2Z PARSER_SEVERITY_VALIDITY_WARNINGZPARSER_SEVERITY_WARNING�_err_handlerZwarning�
fatalError�error)rZfatalr5�	exceptionrrr	�
_reportErrors~s�zLibXml2Reader._reportErrorscCs>d|_�z(t|t�r t�|�}n&t�|�}t�|���}|�	|�
��}|�|jd�|j
r�|�tjd�|�tjd�|�tjd�|�tj|j�n|�tjd�|jr�t�ii�}n
t�i�}g}|j��|��}|dkr�|jdur�|�d�nR|dk�r|jdu�r|�d��qn,|jdu�r4|�d�n|j�td���q|� �}|dk�r|j�r�t!|�"��t!|�#��f}	t!|�$��}
i|_%}i|_&}g}
|�'��r<t!|�$��}t!|�(��}|�)d��rt*|�dk�r�|dd�}nd}|
�+|�|j�,||�|j-�s�q�t!|�"��t!|�#��f}|||<|||<�q�|�.�|j�/|	|
|�|�0��r�|j�1|	|
�|
D]}|j�2|��qpn
|�+|
�nlt!|�$��}	i|_%}|�'��r�t!|�$��}t!|�(��||<�q�|�.�|j�3|	|�|�0��r
|j�4|	�q�|dk�rp|j�rZ|j�1t!|�"��t!|�#��ft!|�$���|�5�D]}|j�2|��qDn|j�4t!|�$���q�|dk�r�|j�6t!|�(���q�|d	k�r�|j�7t!|�(���q�|d
k�r�|j�6t!|�(���q�|dk�r|j8du�r�|j8�9�|j�6t!|�(���|j8du�r
|j8�:�q�|dk�rN|j8du�rD|�;t!|�$���|�<�q�|dk�rx|j8du�r
|�=t!|�$���q�|d
k�r�|j�>t!|�$��t!|�(���q�|dk�r�|j8du�r
|j8�?t!|�(���q�|dk�r�q�|dk�r�q�|dk�r�q�|dk�r�q�td|��q�|dk�r |j�@�|�A�Wd|_nd|_0dS)Nrrz"Read failed (no details available)Zxmlns���r�
������
��zUnexpected node type %d)Br.�
isinstance�StringTypesr7ZnewTextReaderFilenamerZprepare_input_sourceZinputBufferZ
getByteStreamZ
newTextReaderr#ZSetErrorHandlerr6r-Z
SetParserPropZPARSER_LOADDTDZPARSER_DEFAULTATTRSZPARSER_SUBST_ENTITIESZPARSER_VALIDATEr,r*r
ZAttributesNSImplZAttributesImplZ
_cont_handlerZ
startDocumentZReadr1r<r8r9ZSAXExceptionZNodeTyper
ZNamespaceUriZ	LocalName�NameZ_attrsZ_qnamesZMoveToNextAttributeZValue�
startswith�lenr2ZstartPrefixMappingr+Z
MoveToElementZstartElementNSZIsEmptyElementZendElementNSZendPrefixMappingZstartElementZ
endElement�popZ
charactersZignorableWhitespacer/Z
startCDATAZendCDATAZstartEntityZ
ResolveEntityZ	endEntityZprocessingInstructionZcommentZendDocumentZClose)r�source�reader�inputZattributesNSImplZattributesImpl�prefixes�rZnodeTypeZeltNameZeltQName�attrsZqnamesZnewPrefixesZqname�valueZ	newPrefixZattName�prefixrrr	�parse�s






�


�



�

��


�


�








�







zLibXml2Reader.parsecCstd��dS)NzDTDHandler not supported��SAXNotSupportedException)rZhandlerrrr	�
setDTDHandler8szLibXml2Reader.setDTDHandlercCstd��dS)NzEntityResolver not supportedrX)rZresolverrrr	�setEntityResolver<szLibXml2Reader.setEntityResolvercCsT|tkr|jS|tkr|jS|tkr*|jS|tkr6dS|tkrD|jSt	d|��dS)Nr�Feature '%s' not recognized)
rr*rr+rr,rrr-�SAXNotRecognizedException�r�namerrr	�
getFeature@s�zLibXml2Reader.getFeaturecCs�|jrtd|��|tkr"||_nZ|tkr2||_nJ|tkrB||_n:|tkr`|dkr|td|��n|t	krp||_
ntd|��dS)Nz#Cannot set feature %s while parsingrzFeature '%s' not supportedr\)r.rYrr*rr+rr,rrr-r])rr_�staterrr	�
setFeatureOs(���zLibXml2Reader.setFeaturecCs,|tkr|jS|tkr|jStd|��dS)N�Property '%s' not recognized)rr/rr0r]r^rrr	�getPropertyds�zLibXml2Reader.getPropertycCs<|tkr||_n(|tkr,td|��||_ntd|��dS)NzProperty '%s' not supportedrc)rr/rrYr0r])rr_rUrrr	�setPropertyms��zLibXml2Reader.setPropertyN)
r$r%r&rr6r<rWrZr[r`rbrdrerrrr	r(fs,	r(cCst�Sr)r(rrrr	�
create_parserysrf)$r'�
__author__�__version__�sys�codecs�version_info�unicode_escape_decode�strZunicoderJ�lookuprr
Zxml.sax._exceptionsZxml.saxr
rZxml.sax.handlerrrrrrrrrrrr7�ImportErrorZSAXReaderNotAvailable�exc_inforr)r(rfrrrr	�<module>s2#
0
�