Your IP : 52.15.233.83
�
c��f,
� �� � d Z ddlZddlZddlmZmZmZmZ ddlT ddl m
Z
mZ ej j
j ej j
j fZ G d� dej j
� � Z
ee
dd �
� � ee
dd�
� � ee
d
d�
� � d� Zd� Zd� Zd� Zd� Z G d� de
� � Z G d� de
� � Z eedd�
� � eed
d�
� � eedd�
� � G d� de� � Z eedd �
� � eZ G d!� d"e� � Z edd� � Z G d#� d$e
� � Z eed%d&�
� � eed
d'�
� � d(� Z G d)� d*� � Z G d+� d,e e
� � Z! G d-� d.e e
� � Z" ee"dd/�
� � G d0� d1e"� � Z# ee#d2d3�
� � ee#d4d5�
� � d6� Z$d7� Z% G d8� d9e"� � Z& G d:� d;e#� � Z' G d<� d=e� � Z( ee(dd>�
� � G d?� d@� � Z) G dA� dBe)e e
� � Z* G dC� dDe)e
� � Z+ G dE� dFe)e e
� � Z, G dG� dHe
� � Z- G dI� dJe� � Z.dK� Z/ G dL� dMe
e� � Z0 ee0dNdO�
� � dP� Z1dQ� Z2dR� Z3dVdS�Z4dWdT�Z5dWdU�Z6dS )Xac Simple implementation of the Level 1 DOM.
Namespaces and other minor Level 2 features are also supported.
parse("foo.xml")
parseString("<foo><bar/></foo>")
Todo:
=====
* convenience methods for getting elements and text.
* more testing
* bring some of the writer and linearizer code into conformance with this
interface
* SAX 2 namespaces
� N)�EMPTY_NAMESPACE�EMPTY_PREFIX�XMLNS_NAMESPACE�domreg)�*)�DOMImplementationLS�
DocumentLSc � � e Zd ZdZdZdZdZdZeZ d� Z
dd�Z dd�Zd� Z
d� Zd � Zd
� Zd� Zd� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z dS )�NodeNc � � dS )NT� ��selfs �6/opt/alt/python311/lib64/python3.11/xml/dom/minidom.py�__bool__z
Node.__bool__+ � � ��t� c �2 � | � dd||� � S �N� )�toprettyxml)r �encoding�
standalones r �toxmlz
Node.toxml. s � �����B��*�=�=�=r � �
c � � |�t j � � }n)t j t j � � |dd�� � }| j t
j k r| � |d||||� � n| � |d||� � |�|� � � S |� � � � � � S )N�xmlcharrefreplacer )r �errors�newliner )
�io�StringIO�
TextIOWrapper�BytesIO�nodeTyper �
DOCUMENT_NODE�writexml�getvalue�detach)r �indent�newlr r �writers r r zNode.toprettyxml1 s� � ����[�]�]�F�F��%�b�j�l�l�/7�-@�.2�4� 4� 4�F� �=�D�.�.�.��M�M�&�"�f�d�H�j�I�I�I�I��M�M�&�"�f�d�3�3�3����?�?�$�$�$��=�=�?�?�+�+�-�-�-r c �* � t | j � � S �N)�bool�
childNodesr s r �
hasChildNodeszNode.hasChildNodesD s � ��D�O�$�$�$r c � � | j S r. �r0 r s r �_get_childNodeszNode._get_childNodesG �
� ���r c �. � | j r
| j d S d S �Nr r3 r s r �_get_firstChildzNode._get_firstChildJ s# � ��?� &��?�1�%�%� &� &r c �. � | j r
| j d S d S �N���r3 r s r �_get_lastChildzNode._get_lastChildN s# � ��?� '��?�2�&�&� '� 'r c � � |j | j k r/t |j � � D ]}| � ||� � �|S |j | j vr>t j � t |� � �dt | � � ��� � �|j
�|j
� |� � |�| � |� � n� | j �
|� � }n,# t $ r t j � � � �w xY w|j t v rt# | � � | j � ||� � ||_ ||_ |r| j |dz
}||_ ||_ nd |_ | |_
|S )N� cannot be child of � )r% �DOCUMENT_FRAGMENT_NODE�tupler0 �insertBefore�_child_node_types�xml�dom�HierarchyRequestErr�repr�
parentNode�removeChild�appendChild�index�
ValueError�NotFoundErr�_nodeTypes_with_children�_clear_id_cache�insert�nextSibling�previousSibling)r �newChild�refChild�crK �nodes r rB zNode.insertBeforeR s� � ���� ;�;�;��8�.�/�/�
/�
/���!�!�!�X�.�.�.�.��O���D�$:�:�:��'�-�-�.2�8�n�n�n�n�d�4�j�j�j�I�K� K�
K���*���+�+�H�5�5�5������X�&�&�&�&�
,���-�-�h�7�7�����
,�
,�
,��g�)�)�+�+�+�
,����� �$<�<�<���%�%�%��O�"�"�5�(�3�3�3�#+�H� �'/�H�$��
0���u�Q�w�/��#+�� �+/��(�(�+/��(�"&�H���s �C! �!)D
c �� � |j | j k r.t |j � � D ]}| � |� � �|S |j | j vr>t j � t |� � �dt | � � ��� � �|j t v rt | � � |j �|j �
|� � t | |� � d |_ |S �Nr>