File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/lxml/__pycache__/sax.cpython-311.pyc
�
    � h�$  �                   �   � d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 ddlm
Z
mZ  G d� dej        �  �        Z
d	� Z G d
� de�  �        Z G d� d
e�  �        Zd� ZdS )a?  
SAX-based adapter to copy trees from/to the Python standard library.
Use the `ElementTreeContentHandler` class to build an ElementTree from
SAX events.
Use the `ElementTreeProducer` class or the `saxify()` function to fire
the SAX events of an ElementTree against a SAX ContentHandler.
See https://lxml.de/sax.html
�    )�absolute_import)�ContentHandler)�etree)�ElementTree�
SubElement)�Comment�ProcessingInstructionc                   �   � e Zd ZdZdS )�SaxErrorzGeneral SAX error.
    N)�__name__�
__module__�__qualname__�__doc__� �    �=/opt/cloudlinux/venv/lib/python3.11/site-packages/lxml/sax.pyr   r      s   � � � � � �� � � r   r   c                 �x   � | d         dk    r+t          | dd �         �                    dd�  �        �  �        S d | fS )Nr   �{�   �})�tuple�split)�tags    r   �	_getNsTagr      s=   � �
�1�v��}�}��S����W�]�]�3��*�*�+�+�+��S�y�r   c                   �   � e Zd ZdZdd�Zd� Z eeej        ��  �        Zd� Zd� Z	d� Z
d	� Zd
� Zd� Z
dd�Zd
� Zd� Zdd�Zd� Zd� ZeZdS )�ElementTreeContentHandlerz/Build an lxml ElementTree from SAX events.
    Nc                 �   � t          j        | �  �         d | _        g | _        g | _        d | _        d d gi| _        i | _        |�t          j	        }|| _
        d S �N)r   �__init__�_root�_root_siblings�_element_stack�_default_ns�_ns_mapping�
_new_mappingsr   �Element�_makeelement)�self�makeelements     r   r   z"ElementTreeContentHandler.__init__&