Hacked By AnonymousFox
�
�Q�f,
� �` � d Z ddlZddlZddlmZmZmZmZ ddl� 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�Z6y)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 y)�NodeNc � � y)NT� ��selfs �6/opt/alt/python312/lib64/python3.12/xml/dom/minidom.py�__bool__z
Node.__bool__+ � � �� c �* � | j dd||� S �N� )�toprettyxml)r �encoding�
standalones r �toxmlz
Node.toxml. s � �����B��*�=�=r c �v � |�t j � }n+t j t j � |dd�� }| j t
j k( r| j |d||||� n| j |d||� |�|j � S |j � j � S )N�xmlcharrefreplace�
)r �errors�newliner )
�io�StringIO�
TextIOWrapper�BytesIO�nodeTyper �
DOCUMENT_NODE�writexml�getvalue�detach)r �indent�newlr r �writers r r zNode.toprettyxml1 s� � ����[�[�]�F��%�%�b�j�j�l�/7�-@�.2�4�F� �=�=�D�.�.�.��M�M�&�"�f�d�H�j�I��M�M�&�"�f�d�3����?�?�$�$��=�=�?�+�+�-�-r c �, � t | j � S �N)�bool�
childNodesr s r �
hasChildNodeszNode.hasChildNodesD s � ��D�O�O�$�$r c � � | j S r- �r/ r s r �_get_childNodeszNode._get_childNodesG � � ����r c �: � | j r| j d S y �Nr r2 r s r �_get_firstChildzNode._get_firstChildJ s � ��?�?��?�?�1�%�%� r c �: � | j r| j d S y �N���r2 r s r �_get_lastChildzNode._get_lastChildN s � ��?�?��?�?�2�&�&� r c �& � |j | j k( r.t |j � D ] }| j ||� � |S |j | j
vr6t j j t |� �dt | � ��� �|j �|j j |� |�| j |� |S | j j |� }|j t v rt# | � | j j% ||� ||_ ||_ |r!| j |dz
}||_ ||_ nd |_ | |_
|S # t $ r t j j � �w xY w)N� cannot be child of � )r$ �DOCUMENT_FRAGMENT_NODE�tupler/ �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�crJ �nodes r rA zNode.insertBeforeR sn � ����� ;� ;�;��8�.�.�/���!�!�!�X�.� 0� �O����D�$:�$:�:��'�'�-�-�.2�8�n�d�4�j�I�K�
K����*����+�+�H�5������X�&�$ ��!
,����-�-�h�7�� � � �$<�<���%��O�O�"�"�5�(�3�#+�H� �'/�H�$�����u�Q�w�/��#+�� �+/��(�+/��(�"&�H����� �
,��g�g�)�)�+�+�
,�s �E( �((Fc �� � |j | j k( r-t |j � D ] }| j |� � |S |j | j
vr6t j j t |� �dt | � ��� �|j t v rt | � |j �|j j |� t | |� d |_ |S �Nr= )r$ r? r@ r/ rI rB rC rD rE rF rM rN rG rH �
_append_childrP )r rU rT s r rI zNode.appendChildr s� � ��=�=�D�7�7�7��4�?�?�+��� � ��#� ,� �K��=�=�� 6� 6�6��'�'�-�-�.2�4�j�$�t�*�E�G�
G�
�]�]�6�
6��D�!��?�?�&��O�O�'�'��-��d�D�!�����r c � � |j | j k( r/|j }| j |� | j ||� S |j | j
vr6t j j t |� �dt | � ��� �||u ry |j �|j j |� | j j |� }|| j |<