Your IP : 3.141.198.75


Current Path : /opt/alt/python312/lib64/python3.12/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/xml/dom/__pycache__/minidom.cpython-312.opt-1.pyc

�

�Q�f,
��`�dZddlZddlZddlmZmZmZmZddl�ddl	m
Z
mZejjjejjjfZGd�dejj�Z
ee
dd	�
�ee
dd�
�ee
d
d�
�d�Zd�Zd�Zd�Zd�ZGd�de
�ZGd�de
�Zeedd�
�eed
d�
�eedd�
�Gd�de�Zeedd �
�eZGd!�d"e�Zedd�ZGd#�d$e
�Zeed%d&�
�eed
d'�
�d(�ZGd)�d*�Z Gd+�d,e e
�Z!Gd-�d.e e
�Z"ee"dd/�
�Gd0�d1e"�Z#ee#d2d3�
�ee#d4d5�
�d6�Z$d7�Z%Gd8�d9e"�Z&Gd:�d;e#�Z'Gd<�d=e�Z(ee(dd>�
�Gd?�d@�Z)GdA�dBe)e e
�Z*GdC�dDe)e
�Z+GdE�dFe)e e
�Z,GdG�dHe
�Z-GdI�dJe�Z.dK�Z/GdL�dMe
e�Z0ee0dNdO�
�dP�Z1dQ�Z2dR�Z3dVdS�Z4dWdT�Z5dWdU�Z6y)XacSimple 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��eZdZdZdZdZdZdZeZ	d�Z
dd�Z		dd�Zd�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�*�|jdd||�S�N�)�toprettyxml)r�encoding�
standalones   r�toxmlz
Node.toxml.s������B��*�=�=rc�v�|�tj�}n+tjtj�|dd��}|jt
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�newlrr�writers      rrzNode.toprettyxml1s������[�[�]�F��%�%�b�j�j�l�/7�-@�.2�4�F��=�=�D�.�.�.��M�M�&�"�f�d�H�j�I��M�M�&�"�f�d�3����?�?�$�$��=�=�?�+�+�-�-rc�,�t|j�S�N)�bool�
childNodesrs r�
hasChildNodeszNode.hasChildNodesDs���D�O�O�$�$rc��|jSr-�r/rs r�_get_childNodeszNode._get_childNodesG������rc�:�|jr|jdSy�Nrr2rs r�_get_firstChildzNode._get_firstChildJs���?�?��?�?�1�%�%�rc�:�|jr|jdSy�N���r2rs r�_get_lastChildzNode._get_lastChildNs���?�?��?�?�2�&�&�rc�&�|j|jk(r.t|j�D]}|j	||��|S|j|j
vr6tjjt|��dt|�����|j�|jj|�|�|j|�|S	|jj|�}|jt vrt#|�|jj%||�||_||_|r!|j|dz
}||_||_nd|_||_
|S#t$rtjj��wxYw)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      rrAzNode.insertBeforeRsn������ ;� ;�;��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|jk(r-t|j�D]}|j	|��|S|j|j
vr6tjjt|��dt|�����|jtvrt|�|j�|jj|�t||�d|_|S�Nr=)r$r?r@r/rIrBrCrDrErFrMrNrGrH�
_append_childrP)rrUrTs   rrIzNode.appendChildrs����=�=�D�7�7�7��4�?�?�+��� � ��#�,��K��=�=�� 6� 6�6��'�'�-�-�.2�4�j�$�t�*�E�G�
G�
�]�]�6�
6��D�!��?�?�&��O�O�'�'��-��d�D�!�����rc��|j|jk(r/|j}|j|�|j	||�S|j|j
vr6tjjt|��dt|�����||ury|j�|jj|�	|jj|�}||j|<||_
d|_
|jtvs|jtvrt!|�|j|_|j"|_d|_d|_|j"r||j"_|jr||j_|S#t$rtjj��wxYwrW)r$r?rPrHrArBrCrDrErFrGr/rJrKrLrMrNrQ)rrR�oldChildrSrJs     r�replaceChildzNode.replaceChild�s������� ;� ;�;��+�+�H����X�&��$�$�X�x�8�8����D�$:�$:�:��'�'�-�-�.2�8�n�d�4�j�I�K�
K��x������*����+�+�H�5�	(��O�O�)�)�(�3�E�"*������"���"������!9�9�� � �$<�<��D�!�'�3�3���#+�#;�#;�� �#���#'�� ��#�#�3;�H�$�$�0����3;�H� � �0����!�	(��'�'�%�%�'�'�	(�s�F�(F?c��	|jj|�|j�|j|j_|j�|j|j_dx|_|_|jtvrt|�d|_|S#t$rtjj��wxYwr-)r/�removerKrCrDrLrPrQr$rMrNrG�rrZs  rrHzNode.removeChild�s���	(��O�O�"�"�8�,����+�3;�3K�3K�H� � �0��#�#�/�3;�3G�3G�H�$�$�0�:>�>���x�7���� 8�8��D�!�"�������	(��'�'�%�%�'�'�	(�s�B�(Cc���g}|jD�]M}|jtjk(r�|jsN|r|j
|d_|j
r|j|j
_|j��{|r~|dj|jk(rb|d}|j|jz|_|j
|_|j
r||j
_|j���|j|���|j|�|jtjk(s��>|j���P||jddyr9)r/r$r�	TEXT_NODE�datarPrQ�unlink�append�ELEMENT_NODE�	normalize)r�L�childrUs    rrezNode.normalize�s
�����_�_�E��~�~����/��z�z��,1�,=�,=��"��)��(�(�<A�<Q�<Q��)�)�9��L�L�N��1�R�5�>�>�U�^�^�;��R�5�D� $�	�	�E�J�J� 6�D�I�',�'8�'8�D�$��(�(�<@��)�)�9��L�L�N��H�H�U�O�������>�>�T�%6�%6�6��O�O�%�-%�.�����rc�8�t|||jxs|�Sr-)�_clone_node�
ownerDocument)r�deeps  r�	cloneNodezNode.cloneNode�s���4��t�'9�'9�'A�T�B�Brc�N�|jjj||�Sr-)rj�implementation�
hasFeature�r�feature�versions   r�isSupportedzNode.isSupported�s!���!�!�0�0�;�;�G�W�M�Mrc��yr-r
rs r�_get_localNamezNode._get_localName�s��rc�
�||uSr-r
�r�others  r�
isSameNodezNode.isSameNode�s���u�}�rc�,�|j|d�r|Syr-)rs�rrqs  r�getInterfacezNode.getInterface�s�����G�T�*��K�rc�R�	|j|dS#ttf$rYywxYwr6)�
_user_data�AttributeError�KeyError�r�keys  r�getUserDatazNode.getUserData�s2��	��?�?�3�'��*�*����)�	��	�s��&�&c��d}	|j}||vr||d}|�	d}|�||=|S||f||<|S#t$ri}||_Y�4wxYwr6)r~r)rr�ra�handler�old�ds      r�setUserDatazNode.setUserData�sy����	 ����A��!�8��C�&��)�C��<��G����c�F��
��G�_�A�c�F��
���	 ��A��D�O�	 �s�0�A�Ac��t|d�rGt|jj��D] \}\}}|��|j	|||||��"yy)Nr~)�hasattr�listr~�items�handle)r�	operation�src�dstr�rar�s       r�_call_user_data_handlerzNode._call_user_data_handler�sQ���4��&�(,�T�_�_�-B�-B�-D�(E�$��_�d�G��&��N�N�9�c�4��c�B�)F�'rc��dx|_|_|jr0|jD]}|j��t	�|_d|_d|_yr-)rGrjr/rb�NodeListrQrP)rrgs  rrbzNode.unlinksH��/3�3���$�,��?�?���������)�&�j�D�O�#�����rc��|Sr-r
rs r�	__enter__zNode.__enter__s���rc�$�|j�yr-)rb)r�et�ev�tbs    r�__exit__z
Node.__exit__s�����
r�NN)�	rNN)!�__name__�
__module__�__qualname__�namespaceURIrGrjrPrQr�prefixrrrr0r3r7r;rArIr[rHrerlrsruryr|r�r�r�rbr�r�r
rrrr"s����L��J��M��K��O�
�F��>�<@�#�.�&%��&�'��@�"�@� �6C�N������$C� ��rr�
firstChildzFirst child node, or None.)�doc�	lastChildzLast child node, or None.�	localNamez"Namespace-local name of this node.c�v�|j}|r|d}||_||_|j|�||_yr9)r/rQrPrcrG)rrUr/�lasts    rrXrXs<�����J���"�~��#���������d���D�Orc�b�|�-|jtjk(ry|j}|��-y�NTF)r$rr%rG�rUs r�_in_documentr�'s3��
�
��=�=�D�.�.�.�������
�rc��|rT|jdd�jdd�jdd�jdd�}|j|�y	y	)
zWrites datachars to writer.�&z&amp;�<z&lt;�"z&quot;�>z&gt;N)�replace�write)r+ras  r�_write_datar�/sM����|�|�C��)�1�1�#�v�>��G�D�(�+�G�G�C��,@�	
����T��rc���|jD]Q}|jtjk(r%|dk(s|j|k(r|j|�t
|||��S|S�Nr)r/r$rrd�tagNamerc�_get_elements_by_tagName_helper)�parent�name�rcrUs    rr�r�6sT���!�!���=�=�D�-�-�-�
�S�[�D�L�L�D�0��I�I�d�O�'��d�B�7�	"�
�Irc���|jD]g}|jtjk(s�!|dk(s|j|k(r%|dk(s|j
|k(r|j
|�t||||��i|Sr�)r/r$rrdr�r�rc�"_get_elements_by_tagName_ns_helper)r��nsURIr�r�rUs     rr�r�>sk���!�!���=�=�D�-�-�-��c�!�T�^�^�y�%@��#���!2�!2�e�!;��	�	�$��.�t�U�I�r�J�"��Irc���eZdZejZdZdZdZdZ	ejejejejejejej fZd�Zy)�DocumentFragmentz#document-fragmentNc�"�t�|_yr-)r�r/rs r�__init__zDocumentFragment.__init__Us��"�*��r)r�r�r�rr?r$�nodeName�	nodeValue�
attributesrGrdr`�CDATA_SECTION_NODE�ENTITY_REFERENCE_NODE�PROCESSING_INSTRUCTION_NODE�COMMENT_NODE�
NOTATION_NODErBr�r
rrr�r�Gsk���*�*�H�#�H��I��J��J��*�*�����0�0��3�3��9�9��*�*��+�+�
-��%rr�c���eZdZdZej
ZdZdZdZ	ejejfZe
ddfd�Zd�Zd�Zd�Zd�Zeee�xZZd	�Zd
�Zeee�xZZd�Zd�Zeee�Zd
�Zd�Zd�Zy)�Attr)�_name�_valuer��_prefixr/�
_localNamerj�ownerElementNFc��d|_||_||_||_|�||_t�|_|jjt��yr-)	r�r�r�r�r�r�r/rc�Text)r�qNamer�r�r�s     rr�z
Attr.__init__csL�� �����
�(������� �'�D�O�"�*���	
�����t�v�&rc�x�	|jS#t$r"|jjdd�dcYSwxYw�N�:r>r:)r�rr��splitrs rruzAttr._get_localNamers<��	3��?�?�"���	3��=�=�&�&�s�A�.�r�2�2�	3����(9�9c��|jSr-)�	specifiedrs r�_get_specifiedzAttr._get_specifiedx����~�~�rc��|jSr-)r�rs r�	_get_namezAttr._get_name{����z�z�rc�V�||_|j�t|j�yyr-)r�r�rN�r�values  r�	_set_namezAttr._set_name~s(����
����(��D�-�-�.�)rc��|jSr-)r�rs r�
_get_valuezAttr._get_value�����{�{�rc��||_||jd_|j�t	|j�||jd_yr6)r�r/rar�rNr�s  r�
_set_valuezAttr._set_value�sE�����"'����������(��D�-�-�.�"'������rc��|jSr-)r�rs r�_get_prefixzAttr._get_prefix�����|�|�rc��|j}|dk(r*|r(|tk7rtjj	d��||_|�
|j}n|�d|j��}|jrt|j�||_	y)N�xmlnsz5illegal use of 'xmlns' prefix for the wrong namespacer�)
r�rrCrD�NamespaceErrr�r�r�rNr�)rr��nsuri�newNames    r�_set_prefixzAttr._set_prefix�s|���!�!���W����/�1��g�g�*�*�K�M�M�����>��n�n�G�!'����8�G�����D�-�-�.���	rc��|j}|��|j|j=|j|j|j
f=|jr;d|_|xjdzc_|jxjdzc_	|jD]}|j��|jdd�=y)NFr>)r��_attrsr��_attrsNSr�r��_is_id�_magic_id_nodesrj�_magic_id_countr/rb)r�elemrgs   rrbzAttr.unlink�s���
� � �������D�M�M�*��
�
�t�0�0�$�.�.�A�B��{�{�#����$�$��)�$��"�"�2�2�a�7�2��_�_�E��L�L�N�%��O�O�A�rc��|jry|j}|j}|�|�y|j|�}|�y|jr&|j|j|j�S|j|j�Sr�)	r�rjr��_get_elem_infor��isIdNSr��isIdr��rr�r��infos    r�	_get_isIdzAttr._get_isId�s}���;�;��� � ��� � ���;�$�,���!�!�$�'���<������;�;�t�0�0�$�.�.�A�A��9�9�T�]�]�+�+rc��|j}|j}|�|�tS|j|�}|�tS|jr&|j|j|j�S|j|j�Sr-)	rjr��_no_typer�r��getAttributeTypeNSr��getAttributeTyper�r�s    r�_get_schemaTypezAttr._get_schemaType�s{��� � ��� � ���;�$�,��O��!�!�$�'���<��O�����*�*�4�+<�+<�d�n�n�M�M��(�(����7�7r) r�r�r��	__slots__r�ATTRIBUTE_NODEr$r�r�r�r`r�rBrr�rur�r�r��propertyr�r�r�r�r�r�r�r�r�rbr�rr
rrr�r�Ys���W�I��"�"�H��J��I�
�F�����)C�)C�D��+:�d��'�3���/�
�y�)�4�4�H�t��(�!��Z�8�8�I���
��k�;�
/�F��",� 8rr�r�z True if this attribute is an ID.z'Namespace-local name of this attribute.�
schemaTypezSchema type for this attribute.c��eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dd
�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z y) �NamedNodeMapaThe attribute list is a transient interface to the underlying
    dictionaries.  Mutations here will change the underlying element's
    dictionary.

    Ordering is imposed artificially and does not reflect the order of
    attributes as found in an input document.
    �r�r��
_ownerElementc�.�||_||_||_yr-r)r�attrs�attrsNSr�s    rr�zNamedNodeMap.__init__�s�������
�)��rc�,�t|j�Sr-)�lenr�rs r�_get_lengthzNamedNodeMap._get_length�s���4�;�;��rc�t�	|t|jj��|S#t$rYywxYwr-)r�r��keys�
IndexError�rrJs  r�itemzNamedNodeMap.item�s;��	���T�[�[�-�-�/�0��7�8�8���	��	�s�(+�	7�7c��g}|jj�D])}|j|j|jf��+|Sr-)r��valuesrcr�r��rrfrUs   rr�zNamedNodeMap.items�s<�����K�K�&�&�(�D�
�H�H�d�m�m�T�Z�Z�0�1�)��rc��g}|jj�D]5}|j|j|jf|j
f��7|Sr-)r�rrcr�r�r�rs   r�itemsNSzNamedNodeMap.itemsNS�sG�����K�K�&�&�(�D�
�H�H�t�(�(�$�.�.�9�4�:�:�F�G�)��rc�Z�t|t�r||jvS||jvSr-)�
isinstance�strr�r�r�s  r�__contains__zNamedNodeMap.__contains__�s*���c�3���$�+�+�%�%��$�-�-�'�'rc�6�|jj�Sr-)r�rrs rrzNamedNodeMap.keyss���{�{���!�!rc�6�|jj�Sr-)r�rrs r�keysNSzNamedNodeMap.keysNSs���}�}�!�!�#�#rc�6�|jj�Sr-)r�rrs rrzNamedNodeMap.values
s���{�{�!�!�#�#rNc�:�|jj||�Sr-�r��get)rr�r�s   rr'zNamedNodeMap.get
s���{�{���t�U�+�+rc��|jt|dd�uryt|�t|�kDt|�t|�kz
S)Nr�r)r��getattr�idrws  r�_cmpzNamedNodeMap._cmps?���;�;�'�%��4�8�8���t�H�r�%�y�(�R��X��5�	�-A�B�Brc�*�|j|�dk(Sr6�r+rws  r�__eq__zNamedNodeMap.__eq__����y�y���1�$�$rc�*�|j|�dk\Sr6r-rws  r�__ge__zNamedNodeMap.__ge__r/rc�*�|j|�dkDSr6r-rws  r�__gt__zNamedNodeMap.__gt__����y�y���!�#�#rc�*�|j|�dkSr6r-rws  r�__le__zNamedNodeMap.__le__!r/rc�*�|j|�dkSr6r-rws  r�__lt__zNamedNodeMap.__lt__$r4rc�^�t|t�r|j|S|j|Sr-)rr@r�r�)r�attname_or_tuples  r�__getitem__zNamedNodeMap.__getitem__'s-���&��.��=�=�!1�2�2��;�;�/�0�0rc�J�t|t�r	|j|}||_yt|t�std��|}|j|�y#t$rAt	|�}|j
j|_|j|�Y||_ywxYw)Nz%value must be a string or Attr object)
rrr�r�r�rrj�setNamedItemr��	TypeError)r�attnamer�rUs    r�__setitem__zNamedNodeMap.__setitem__.s����e�S�!�
(��{�{�7�+��
�D�J��e�T�*�� G�H�H��D����d�#���
(��G�}��%)�%7�%7�%E�%E��"��!�!�$�'��D�J�	
(�s�A�AB"�!B"c�@�	|j|S#t$rYywxYwr-)r�r��rr�s  r�getNamedItemzNamedNodeMap.getNamedItem=s(��	��;�;�t�$�$���	��	�s��	�c�D�	|j||fS#t$rYywxYwr-)r�r��rr�r�s   r�getNamedItemNSzNamedNodeMap.getNamedItemNSCs-��	��=�=�,�	�!:�;�;���	��	�s��	�c�,�|j|�}|�dt|j�|j|j=|j
|j|jf=t|d�rd|_	|Stjj���Nr�)
rCrNrr�r�r�r�r�r�r�rCrDrL�rr��ns   r�removeNamedItemzNamedNodeMap.removeNamedItemIsw�����d�#���=��D�.�.�/����A�J�J�'��
�
�q�~�~�q�{�{�;�<��q�.�)�!%����H��'�'�%�%�'�'rc�.�|j||�}|�dt|j�|j|j|j
f=|j|j=t|d�rd|_	|Stjj��rH)
rFrNrr�r�r�r�r�r�r�rCrDrL�rr�r�rJs    r�removeNamedItemNSzNamedNodeMap.removeNamedItemNSUsy������i�8���=��D�.�.�/��
�
�q�~�~�q�{�{�;�<����A�J�J�'��q�.�)�!%����H��'�'�%�%�'�'rc���t|t�s6tjj	t|��dt|�����|jj|j�}|r|j�||j|j<||j|j|jf<|j|_t|j�|SrW)rr�rCrDrErFr�r'r�rbr�r�r�rr�rN)rrUr�s   rr=zNamedNodeMap.setNamedItemas����$��%��'�'�-�-�.2�4�j�$�t�*�E�G�
G��k�k�o�o�d�i�i�(����J�J�L�!%����D�I�I��=A��
�
�t�(�(�$�.�.�9�:� �.�.�����)�)�*��
rc�$�|j|�Sr-)r=�rrUs  r�setNamedItemNSzNamedNodeMap.setNamedItemNSns��� � ��&�&rc�X�||}t|j�|j�yr-)rNr�rb)rr:rUs   r�__delitem__zNamedNodeMap.__delitem__qs$���$�%����)�)�*����
rc�H�|j|j|jfSr-rrs r�__getstate__zNamedNodeMap.__getstate__vs���{�{�D�M�M�4�+=�+=�=�=rc�.�|\|_|_|_yr-r�r�states  r�__setstate__zNamedNodeMap.__setstate__ys��9>�6���T�]�D�$6rr-)!r�r�r��__doc__rr�rrr�rr rr#rr'�__len__r+r.r1r3r6r8r;r@rCrFrKrNr=rRrTrVrZr
rrr
r
�s����8�I�*�
 ����(�"�$�$�,��G�C�%�%�$�%�$�1�
$���
(�
(��'��
>�?rr
�lengthz$Number of nodes in the NamedNodeMap.c�(�eZdZdZd�Zd�Zd�Zd�Zy)�TypeInfo��	namespacer�c� �||_||_yr-r`)rrar�s   rr�zTypeInfo.__init__�s��"�����	rc���|jr4d|jj�d|j�d|j�d�Sd|jj�d|j�d�S)Nr�� z (from z)>r�)ra�	__class__r�r�rs r�__repr__zTypeInfo.__repr__�sM���>�>�*.�.�.�*A�*A�4�9�9�*.�.�.�:�
:��!%��� 7� 7����C�Crc��|jSr-)r�rs rr�zTypeInfo._get_name�����y�y�rc��|jSr-)rars r�_get_namespacezTypeInfo._get_namespace�r�rN)r�r�r�rr�rfr�rjr
rrr_r_�s��#�I��D��rr_c�j�eZdZdZej
ZdZeZ	dZ
ej
ejejejejejfZeddfd�Zd�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�ZeZd�Zd�Z d�Z!e!Z"d�Z#d�Z$d�Z%d�Z&d�Z'dd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-y)�Element)rjrGr�r�r�r�r�r/r�r�rPrQNrc��d|_|x|_|_||_||_t�|_dx|_|_d|_	d|_
yr-)rGr�r�r�r�r�r/rPrQr�r�)rr�r�r�r�s     rr�zElement.__init__�sO�����'.�.���t�}����(���"�*���26�6���4�/������
rc�:�|j�i|_i|_yyr-)r�r�rs r�_ensure_attributeszElement._ensure_attributes�s���;�;���D�K��D�M�rc�x�	|jS#t$r"|jjdd�dcYSwxYwr�)r�rr�r�rs rruzElement._get_localName�s<��	2��?�?�"���	2��<�<�%�%�c�1�-�b�1�1�	2�r�c��|jSr-�r�rs r�_get_tagNamezElement._get_tagName�r�rc���|j�8t|jj��D]}|j��d|_d|_t
j|�yr-)r�r�rrbr�r)r�attrs  rrbzElement.unlink�sK���;�;�"��T�[�[�/�/�1�2�����
�3������
����D�rc�n�|j�y	|j|jS#t$rYywxYw)a�Returns the value of the specified attribute.

        Returns the value of the element's attribute named attname as
        a string. An empty string is returned if the element does not
        have such an attribute. Note that an empty string may also be
        returned as an explicitly given attribute value, use the
        hasAttribute method to distinguish these two cases.
        r)r�r�r�)rr?s  r�getAttributezElement.getAttribute�s=���;�;���	��;�;�w�'�-�-�-���	��	�s�(�	4�4c�r�|j�y	|j||fjS#t$rYywxYwr)r�r�r�rEs   r�getAttributeNSzElement.getAttributeNS�s@���=�=� ��	��=�=�,�	�!:�;�A�A�A���	��	�s�*�	6�6c���|j|�}|�5t|�}||_|j|_|j	|�y||jk7r ||_|j
rt
|�yyyr-)�getAttributeNoder�r�rj�setAttributeNoder�rN)rr?r�rus    r�setAttributezElement.setAttribute�so���$�$�W�-���<���=�D��D�J�!%�!3�!3�D���!�!�$�'�
�d�j�j�
 ��D�J��y�y���%��!rc�N�t|�\}}|j||�}|�8t||||�}||_|j|_|j|�y||jk7r||_|jrt|�|j|k7r||_||_	yyr-)
�_nssplit�getAttributeNodeNSr�r�rjr|r�rNr�r�)rr��
qualifiedNamer�r��	localnamerus       r�setAttributeNSzElement.setAttributeNS�s���$�]�3���	��&�&�|�Y�?���<��
�|�Y��G�D��D�J�!%�!3�!3�D���!�!�$�'���
�
�"�"��
��9�9�#�D�)��{�{�f�$�$��� -��
�%rc�R�|j�y|jj|�Sr-r&)r�attrnames  rr{zElement.getAttributeNodes"���;�;����{�{���x�(�(rc�V�|j�y|jj||f�Sr-)r�r'rEs   rr�zElement.getAttributeNodeNS
s)���=�=� ���}�}� � �,�	�!:�;�;rc��|jd|fvrtjjd��|j	�|j
j
|jd�}|�|j|�|jj
|j|jfd�}|�||ur|j|�t||�||ur|S||ur|Sy)Nzattribute node already owned)
r�rCrD�InuseAttributeErrror�r'r��removeAttributeNoder�r�r��_set_attribute_node)rru�old1�old2s    rr|zElement.setAttributeNodes������T�4�L�0��'�'�+�+�,J�K�K����!��{�{���t�y�y�$�/�����$�$�T�*��}�}� � �$�"3�"3�T�^�^�!D�d�K�����D� 0��$�$�T�*��D�$�'��t���K��t���K�rc���|j�tjj��	|j|}|j
|�y#t
$rtjj��wxYwr-)r�rCrDrLr�r�r�)rr�rus   r�removeAttributezElement.removeAttribute'sf���=�=� ��'�'�%�%�'�'�	(��;�;�t�$�D�	
� � ��&���	(��'�'�%�%�'�'�	(�s�A
�
(A5c���|j�tjj��	|j||f}|j|�y#t$rtjj��wxYwr-)r�rCrDrLr�r�)rr�r�rus    r�removeAttributeNSzElement.removeAttributeNS0sk���=�=� ��'�'�%�%�'�'�	(��=�=�,�	�!:�;�D�	
� � ��&���	(��'�'�%�%�'�'�	(�s�A�(A7c�(�|�tjj��	|j|jt
|�|j�|j|_|S#t
$rtjj��wxYwr-)	rCrDrLr�r�r�rNrbrjrQs  rr�zElement.removeAttributeNode9s{���<��'�'�%�%�'�'�	(��K�K��	�	�"�	������
�"�/�/�������	(��'�'�%�%�'�'�	(�s�A)�)(Bc�8�|j�y||jvS)z�Checks whether the element has an attribute with the specified name.

        Returns True if the element has an attribute with the specified name.
        Otherwise, returns False.
        F�r�rBs  r�hasAttributezElement.hasAttributeIs ���;�;����t�{�{�"�"rc�<�|j�y||f|jvS�NF)r�rEs   r�hasAttributeNSzElement.hasAttributeNSSs#���=�=� ���i�(�D�M�M�9�9rc�,�t||t��S)z�Returns all descendant elements with the given tag name.

        Returns the list of all descendant elements (not direct children
        only) with the specified tag name.
        �r�r�rBs  r�getElementsByTagNamezElement.getElementsByTagNameXs��/�t�T�8�:�F�Frc�.�t|||t��Sr-�r�r�rEs   r�getElementsByTagNameNSzElement.getElementsByTagNameNS`���1��,�	�8�:�7�	7rc�6�d|jt|�fzS)Nz<DOM Element: %s at %#x>)r�r*rs rrfzElement.__repr__ds��)�T�\�\�2�d�8�,D�D�Drc�,�|j|dz|jz�|j�}|j�D]@}|jd|z�t	|||j
�|jd��B|jr�|jd�t|j�dk(r[|jdjtjtjfvr"|jdj|ddd�nJ|j|�|jD]}|j|||z||��|j|�|jd|j�d|���y
|jd	|z�y
)z�Write an XML element to a file-like object

        Write the element to the writer object that must provide
        a write method (e.g. a file or StringIO object).
        r�z %s="r�r�r>rrz</z/>%sN)
r�r��_get_attributesrr�r�r/rr$rr`r�r&)rr+r)�	addindentr*r�a_namerUs        rr&zElement.writexmlgs>��	���V�C�Z�$�,�,�.�/��$�$�&���j�j�l�F��L�L��F�*�+����f�
� 3� 3�4��L�L���#��?�?��L�L����D�O�O�$��)�����"�+�+�����(?�(?�0A�A�����"�+�+�F�B��B�?����T�"� �O�O�D��M�M�&�&��*:�I�t�L�,����V�$��L�L�d�l�l�D�9�:��L�L����'rc�d�|j�t|j|j|�Sr-)ror
r�r�rs rr�zElement._get_attributes�s%�����!��D�K�K�����=�=rc��|jryyr�r�rs r�
hasAttributeszElement.hasAttributes�s���;�;��rc�H�|j|�}|j|�yr-)r{�setIdAttributeNode)rr��idAttrs   r�setIdAttributezElement.setIdAttribute�s ���&�&�t�,������'rc�J�|j||�}|j|�yr-)r�r�)rr�r�r�s    r�setIdAttributeNSzElement.setIdAttributeNS�s"���(�(��y�A������'rc�r�|�|j|j�stjj	��t|��tjj
��|jsGd|_|xjdz
c_|jxjdz
c_
t|�yy)NTr>)ryr�rCrDrL�_get_containing_entref�NoModificationAllowedErrr�r�rjr�rN)rr�s  rr�zElement.setIdAttributeNode�s����>�����1D�1D�!E��'�'�%�%�'�'�!�$�'�3��'�'�2�2�4�4��}�}� �F�M�� � �A�%� ����.�.�!�3�.��D�!�	r�rrr).r�r�r�rrrdr$r�rrr�r�r�r`r�r�rBrr�rorursrbrwryr}r�r{r�r|�setAttributeNodeNSr�r�r��removeAttributeNodeNSr�r�r�r�rfr&r�r�r�r�r�r
rrrlrl�s��1�I�� � �H��I��J��O��*�*��9�9��*�*�����0�0��3�3�5��.=�T���(�
2���� �
&�.�")�
<�
�&*��'�'��0��#�:�
G�7�E�(�@>��(�(�	"rrlr�z*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.c���t|�|j�||j|j<||j|j
|jf<||_yr-)rNror�r�r�r�r�r�)�elementrus  rr�r��sQ���G����� � $�G�N�N�4�9�9��<@�G���d�'�'����8�9�
 �D�rc�^�eZdZdZdZdZe�ZdZdZ	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�Zy)�	Childlessz�Mixin that makes childless-ness easy to implement and avoids
    the complexity of the Node methods that deal with children.
    r
Nc��yr-r
rs rr7zChildless._get_firstChild�rrc��yr-r
rs rr;zChildless._get_lastChild�rrc�Z�tjj|jdz��)Nz nodes cannot have children�rCrDrEr�rQs  rrIzChildless.appendChild��&���g�g�)�)��M�M�9�9�;�	;rc��yr�r
rs rr0zChildless.hasChildNodes����rc�Z�tjj|jdz���Nz nodes do not have childrenr��rrRrSs   rrAzChildless.insertBefore�r�rc�Z�tjj|jdz��r�)rCrDrLr�r^s  rrHzChildless.removeChild�s&���g�g�!�!��M�M�9�9�;�	;rc��yr-r
rs rrezChildless.normalize�s��rc�Z�tjj|jdz��r�r��rrRrZs   rr[zChildless.replaceChild�r�r)r�r�r�r[rr��
EmptyNodeListr/r�r�r7r;rIr0rArHrer[r
rrr�r��sL����I��J���J��J��I���;��;�;�
�;rr�c�r�eZdZejZdZd�Zd�Zd�Z	e
ee	�Zd�Zd�Z
e
ee
�Zd	d�Zy)
�ProcessingInstruction��targetrac� �||_||_yr-r�)rr�ras   rr�zProcessingInstruction.__init__�s�������	rc��|jSr-�rars r�_get_nodeValuez$ProcessingInstruction._get_nodeValue�rhrc��||_yr-r�r�s  r�_set_nodeValuez$ProcessingInstruction._set_nodeValue�s	����	rc��|jSr-�r�rs r�
_get_nodeNamez#ProcessingInstruction._get_nodeName�r�rc��||_yr-r�r�s  r�
_set_nodeNamez#ProcessingInstruction._set_nodeName�s	����rc	�d�|j|�d|j�d|j�d|���y)Nz<?rd�?>)r�r�ra�rr+r)r�r*s     rr&zProcessingInstruction.writexml�s������t�{�{�D�I�I�t�L�MrNr�)r�r�r�rr�r$rr�r�r�rr�r�r�r�r&r
rrr�r��sI���/�/�H�"�I��
�����8�I����
�}�5�H�Nrr�c�f�eZdZdZd�Zd�ZeZd�Zd�Ze	ee�xZ
Zd�Zd�Z
d�Zd	�Zd
�Zd�Zy)
�
CharacterData)�_datarjrGrQrPc�t�dx|_|_dx|_|_d|_t
j
|�yr)rjrGrQrPr�rr�rs rr�zCharacterData.__init__�s4��/3�3���T�_�26�6���t�/���
��
�
�d�rc�,�t|j�Sr-)rrars rrzCharacterData._get_length����4�9�9�~�rc��|jSr-�r�rs r�	_get_datazCharacterData._get_datar�rc��||_yr-r��rras  r�	_set_datazCharacterData._set_data	s	����
rc��|j}t|�dkDrd}nd}d|jj�d|dd�|�d�S)N�
z...rz<DOM z node "rz">)rarrer�)rra�	dotdotdots   rrfzCharacterData.__repr__sB���y�y���t�9�r�>��I��I���N�N�#�#�T�!�B�Z��<�	<rc�$�|dkrtjjd��|t|j�k\rtjjd��|dkrtjjd��|j|||zS�Nr�offset cannot be negative�#offset cannot be beyond end of datazcount cannot be negative�rCrD�IndexSizeErrrra�r�offset�counts   r�
substringDatazCharacterData.substringDatasw���A�:��'�'�&�&�'B�C�C��S����^�#��'�'�&�&�'L�M�M��1�9��'�'�&�&�'A�B�B��y�y���u��-�-rc�,�|j|z|_yr-r�)r�args  r�
appendDatazCharacterData.appendData s���I�I��O��	rc��|dkrtjjd��|t|j�k\rtjjd��|r(|jd|�|�|j|d��|_yy)Nrr�r�r�)rr�r�s   r�
insertDatazCharacterData.insertData#ss���A�:��'�'�&�&�'B�C�C��S����^�#��'�'�&�&�'L�M�M���	�	�'�6�"�C����6�7�);�=�D�I�rc�V�|dkrtjjd��|t|j�k\rtjjd��|dkrtjjd��|r(|jd||j||zdz|_yyr�r�r�s   r�
deleteDatazCharacterData.deleteData,s����A�:��'�'�&�&�'B�C�C��S����^�#��'�'�&�&�'L�M�M��1�9��'�'�&�&�'A�B�B���	�	�'�6�*�T�Y�Y�v�e�|�}�-E�E�D�I�rc�\�|dkrtjjd��|t|j�k\rtjjd��|dkrtjjd��|r+|jd|�|�|j||zd��|_yyr�r�)rr�r�r�s    r�replaceDatazCharacterData.replaceData6s����A�:��'�'�&�&�'B�C�C��S����^�#��'�'�&�&�'L�M�M��1�9��'�'�&�&�'A�B�B���	�	�'�6�"�C����6�%�<�=�)A�C�D�I�rN)r�r�r�rr�rr\r�r�rrar�rfr�r�r�r�r�r
rrr�r��sS��W�I����G��� �	�9�5�5�D�9�<�.�$�=�F�	Crr�zLength of the string data.c�P�eZdZdZej
ZdZdZd�Z	d	d�Z
d�Zd�Zd�Z
y)
r�r
z#textNc���|dks|t|j�kDrtjj	d��|j�}|j|d|_|j|_|j}|jrR||jjvr:|�|jj|�n|jj||�|jd||_|S)Nrzillegal offset value)rrarCrDr�rerjrPrGr/rIrA)rr��newText�nexts    r�	splitTextzText.splitTextKs����A�:��#�d�i�i�.�0��'�'�&�&�'=�>�>��.�.�"���y�y���)��� $� 2� 2��������?�?�t�t���'A�'A�A��|����+�+�G�4����,�,�W�d�;��I�I�g�v�&��	��rc�<�t||�|j�|���yr-)r�rar�s     rr&z
Text.writexmlZs���F���	�	�4�@�Arc���|jg}|j}|�Y|jtjtj
fvr)|j
d|j�|j}nn|��Y|j}|�X|jtjtj
fvr(|j|j�|j}nn|��Xdj|�S)Nrr)
rarQr$rr`r�rOrPrc�join)rrfrJs   r�_get_wholeTextzText._get_wholeText_s���
�Y�Y�K��� � ���m��z�z�d�n�n�d�.E�.E�F�F�����A�F�F�#��%�%����m�
�����m��z�z�d�n�n�d�.E�.E�F�F������� ��M�M����m��w�w�q�z�rc���|j}|j}|�P|jtjtj
fvr |j}|j
|�|}nn|��P|j}|s|j
|�|�P|jtjtj
fvr |j}|j
|�|}nn|��P|r	||_|Syr-)	rGrQr$rr`r�rHrPra)r�contentr�rJr�s     r�replaceWholeTextzText.replaceWholeTextqs�������� � ���m��z�z�d�n�n�d�.E�.E�F�F��(�(���"�"�1�%����
�m�
��������t�$��m��z�z�d�n�n�d�.E�.E�F�F��}�}���"�"�1�%����
�m���D�I��K�rc��|jj�ryt|�}|�y|jj	|�}|�y|j�Sr�)ra�strip�_get_containing_elementrjr��isElementContent)rr�r�s   r�!_get_isWhitespaceInElementContentz&Text._get_isWhitespaceInElementContent�sR���9�9�?�?���&�t�,���<���!�!�0�0��6���<���(�(�*�*rr�)r�r�r�rrr`r$r�r�r�r&rrr
r
rrr�r�Ds4���I��~�~�H��H��J�
�B�
�$�8
+rr��isWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content.�	wholeTextz.The text of all logically-adjacent text nodes.c�|�|j}|�.|jtjk(r|S|j}|��.yr-)rGr$rrd�rUrTs  rrr�s<�����A�
�-��:�:��*�*�*��H�
�L�L���-�rc�|�|j}|�.|jtjk(r|S|j}|��.yr-)rGr$rr�rs  rr�r��s<�����A�
�-��:�:��3�3�3��H�
�L�L���-�rc�6�eZdZejZdZd�Zdd�Zy)�Commentz#commentc�<�tj|�||_yr-)r�r�r�r�s  rr�zComment.__init__�s�����t�$���
rc�|�d|jvrtd��|j|�d|j�d|���y)Nz--z%'--' is not allowed in a comment nodez<!--z-->)rarKr�r�s     rr&zComment.writexml�s1���4�9�9���D�E�E������	�	�4�@�ArNr�)	r�r�r�rr�r$r�r�r&r
rrrr�s��� � �H��H��Brrc�4�eZdZdZej
ZdZdd�Zy)�CDATASectionr
z#cdata-sectionc��|jjd�dk\rtd��|jd|jz�y)Nz]]>rz$']]>' not allowed in a CDATA sectionz<![CDATA[%s]]>)ra�findrKr�r�s     rr&zCDATASection.writexml�s9���9�9�>�>�%� �A�%��C�D�D����%��	�	�1�2rNr�)	r�r�r�rrr�r$r�r&r
rrrr�s���I��&�&�H��H�3rrc�`�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)�ReadOnlySequentialNamedNodeMap��_seqc��||_yr-r)r�seqs  rr�z'ReadOnlySequentialNamedNodeMap.__init__�s	����	rc�,�t|j�Sr-�rrrs rr\z&ReadOnlySequentialNamedNodeMap.__len__�r�rc�,�t|j�Sr-rrs rrz*ReadOnlySequentialNamedNodeMap._get_length�r�rc�L�|jD]}|j|k(s�|cSyr-)rr�rIs   rrCz+ReadOnlySequentialNamedNodeMap.getNamedItem�s!�����A��z�z�T�!���rc�l�|jD]%}|j|k(s�|j|k(s�#|cSyr-)rr�r�rMs    rrFz-ReadOnlySequentialNamedNodeMap.getNamedItemNS�s,�����A��~�~��-�!�+�+��2J���rc��t|t�r|j|�}n|j|�}|�t	|��|Sr-)rr@rFrCr�)r�
name_or_tuplerUs   rr;z*ReadOnlySequentialNamedNodeMap.__getitem__�sC���m�U�+�&�4�&�&�
�6�D��$�$�]�3�D��<��=�)�)��rc�L�|dkry	|j|S#t$rYywxYwr6)rrrs  rrz#ReadOnlySequentialNamedNodeMap.item�s2���1�9��	��9�9�U�#�#���	��	�s��	#�#c�@�tjjd���Nz"NamedNodeMap instance is read-only�rCrDr�rBs  rrKz.ReadOnlySequentialNamedNodeMap.removeNamedItem�����g�g�.�.�0�2�	2rc�@�tjjd��r'r(rEs   rrNz0ReadOnlySequentialNamedNodeMap.removeNamedItemNS�r)rc�@�tjjd��r'r(rQs  rr=z+ReadOnlySequentialNamedNodeMap.setNamedItem�r)rc�@�tjjd��r'r(rQs  rrRz-ReadOnlySequentialNamedNodeMap.setNamedItemNS�r)rc��|jgSr-rrs rrVz+ReadOnlySequentialNamedNodeMap.__getstate__s���	�	�{�rc��|d|_yr6rrXs  rrZz+ReadOnlySequentialNamedNodeMap.__setstate__s
���!�H��	rN)r
)r�r�r�rr�r\rrCrFr;rrKrNr=rRrVrZr
rrrr�sH���I�����
�
��2�2�2�2��rrz&Number of entries in the NamedNodeMap.c�&�eZdZdZdZd�Zd�Zd�Zy)�
Identifiedz@Mix-in class that supports the publicId and systemId attributes.��publicId�systemIdc� �||_||_yr-r1)rr2r3s   r�_identified_mixin_initz!Identified._identified_mixin_inits�� ��
� ��
rc��|jSr-)r2rs r�
_get_publicIdzIdentified._get_publicId����}�}�rc��|jSr-)r3rs r�
_get_systemIdzIdentified._get_systemIdr8rN)r�r�r�r[rr5r7r:r
rrr0r0
s��J�&�I�!��rr0c�R�eZdZejZdZdZdZdZ	dZ
d�Zd�Zd�Z
dd�Zy)�DocumentTypeNc��t�|_t�|_|rt|�\}}||_|j|_yr-)r�entities�	notationsrr�r�)rr�r�r�s    rr�zDocumentType.__init__$s:��6�8��
�7�9���� (�� 7��F�I�!�D�I��	�	��
rc��|jSr-)�internalSubsetrs r�_get_internalSubsetz DocumentType._get_internalSubset,����"�"�"rc��|j���td�}|j|_|j|_tj
jj}|�r\g|j_	g|j_	|jjD]e}t|j|j|j�}|jjj|�|j|||��g|jjD]�}t!|j|j|j|j"�}|j$|_|j&|_|j(|_|jjj|�|j|||���|j|||�|Syr-)rjr<r�r�rCrD�UserDataHandler�NODE_CLONEDr>rr?�Notationr2r3rcr��Entity�notationName�actualEncodingrrr)rrk�cloner�rJ�notation�e�entitys        rrlzDocumentType.cloneNode/sY�����%� ��&�E����E�J�!�Y�Y�E�N����/�/�;�;�I��&(����#�')����$����,�,�A�'��
�
�A�J�J��
�
�K�H��O�O�(�(�/�/��9��-�-�i��H�E�-����+�+�A�#�A�J�J��
�
�A�J�J�$%�N�N�4�F�,-�,<�,<�F�)�&'�j�j�F�O�%&�Y�Y�F�N��N�N�'�'�.�.�v�6��-�-�i��F�C�,�
�(�(��D�%�@��L�rc
���|jd�|j|j�|jr2|j|�d|j�d|�d|j�d��n-|jr!|j|�d|j�d��|j�=|jd�|j|j�|jd�|jd|z�y)	Nz
<!DOCTYPE z
  PUBLIC '�'z  'z
  SYSTEM 'z [�]r�)r�r�r2r3rAr�s     rr&zDocumentType.writexmlJs������\�"����T�Y�Y���=�=��L�L� �$�-�-��t�}�}�F�
G�
�]�]��L�L�d�D�M�M�B�C����*��L�L����L�L��,�,�-��L�L������S��X�rr�)r�r�r�r�DOCUMENT_TYPE_NODEr$r�r�r2r3rAr�rBrlr&r
rrr<r<s:���&�&�H��I��D��H��H��N�"�#��6rr<c�h�eZdZdZej
ZdZdZdZ	dZ
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd	�Zy)
rHNc�b�||_||_t�|_|j	||�yr-)r�rIr�r/r5)rr�r2r3rLs     rr�zEntity.__init__as*����
�$���"�*����#�#�H�h�7rc��|jSr-�rJrs r�_get_actualEncodingzEntity._get_actualEncodinggrCrc��|jSr-�rrs r�
_get_encodingzEntity._get_encodingjr8rc��|jSr-�rrrs r�_get_versionzEntity._get_versionmr�rc�@�tjjd��)Nz(cannot append children to an entity node�rCrDrE)rrRs  rrIzEntity.appendChildps���g�g�)�)�6�8�	8rc�@�tjjd��)Nz+cannot insert children below an entity noder_r�s   rrAzEntity.insertBeforets���g�g�)�)�9�;�	;rc�@�tjjd��)Nz*cannot remove children from an entity noder_r^s  rrHzEntity.removeChildxs���g�g�)�)�8�:�	:rc�@�tjjd��)Nz)cannot replace children of an entity noder_r�s   rr[zEntity.replaceChild|s���g�g�)�)�7�9�	9r)r�r�r�r�r�ENTITY_NODEr$r�rJrrrr�rWrZr]rIrArHr[r
rrrHrHXsN���J����H��I��N��H��G�8�#���8�;�:�9rrHc�.�eZdZejZdZd�Zy)rGNc�6�||_|j||�yr-)r�r5)rr�r2r3s    rr�zNotation.__init__�s����
��#�#�H�h�7r)r�r�r�rr�r$r�r�r
rrrGrG�s���!�!�H��I�8rrGc�2�eZdZgd�Zd�Zd�Zd�Zd�Zd�Zy)�DOMImplementation))�core�1.0)rh�2.0)rhN)rCri)rCrj)rCN)�ls-loadz3.0)rkNc�L�|dk(rd}|j�|f|jvSr)�lower�	_featuresrps   rrozDOMImplementation.hasFeature�s(���b�=��G��
�
���)�T�^�^�;�;rc�H�|r+|j�tjjd��|j	�}|duxr
|duxr|du}|s!|rtjjd��|r�t
|�\}}|dk(r$|dk7rtjjd��|r!|stjjd��|j||�}|r|j|�|j|�|r|x|_|_
||_||_|S)Nz(doctype object owned by another DOM treezElement with no namerCz$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces)
rGrCrD�WrongDocumentErr�_create_document�InvalidCharacterErrrr��createElementNSrIrj�doctypern)	rr�r�rtr��add_root_elementr�r�r�s	         r�createDocumentz DOMImplementation.createDocument�s.���w�)�)�5��'�'�*�*�:�<�
<��#�#�%�� ,�� 4�!4�$1�T�$9�!4�$+�t�O�5���!1��'�'�-�-�.D�E�E�� (�� 7��F�I�����#I�I��g�g�*�*�+H�I�I��l��g�g�*�*�>�@�@��)�)�,�
�F�G������(��O�O�G�$��9<�<�G���!6����!����
rc�8�t|�}||_||_|Sr-)r<r2r3)rr�r2r3rts     r�createDocumentTypez$DOMImplementation.createDocumentType�s!���}�-��#���#����rc�,�|j|d�r|Syr-)ror{s  rr|zDOMImplementation.getInterface�s���?�?�7�D�)��K�rc��t�Sr-)�Documentrs rrqz"DOMImplementation._create_document�s
���z�rN)	r�r�r�rnrorvrxr|rqr
rrrgrg�s#���I�<�
+�Z��rrgc�J�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�ElementInfoz�Object that represents content-model information for an element.

    This implementation is not expected to be used in practice; DOM
    builders should provide implementations which do the right thing
    using information available to it.

    rrc��||_yr-rrrBs  rr�zElementInfo.__init__�s	����rc��tSr-�r�r�anames  rrzElementInfo.getAttributeType�����rc��tSr-r�rEs   rrzElementInfo.getAttributeTypeNS�r�rc��yr�r
rs rr	zElementInfo.isElementContent�r�rc��y)zQReturns true iff this element is declared to have an EMPTY
        content model.Fr
rs r�isEmptyzElementInfo.isEmpty�s��rc��y)z7Returns true iff the named attribute is a DTD-style ID.Fr
r�s  rr�zElementInfo.isId����rc��y)z<Returns true iff the identified attribute is a DTD-style ID.Fr
rEs   rr�zElementInfo.isIdNS�r�rc��|jSr-rrrs rrVzElementInfo.__getstate__�r�rc��||_yr-rrrXs  rrZzElementInfo.__setstate__�s	����rN)r�r�r�r[rr�rrr	r�r�r�rVrZr
rrr}r}�s;����I������
���rr}c��|jtjk(r"|jj	�d|_yt
|�r6|jjj	�d|j_yyr-)r$rr%�	_id_cache�clear�_id_search_stackr�rjr�s rrNrNs_���}�}��*�*�*������� $���	�d�	����$�$�*�*�,�-1����+�
rc��eZdZdZej
ejejejfZ	e
�ZejZ
dZdZdZdZdxZZdZdZdZdZdZdZdZdZd�Zd�Zd�Zd	�Zd
�Z d�Z!d�Z"d
�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d�Z3d�Z4d�Z5d �Z6d!�Z7d"�Z8d#�Z9d$�Z:		d'd%�Z;d&�Z<y)(r{)�
_elem_infortr�r/r�z	#documentNFrc�Z�d|_t�|_i|_i|_d|_yr-)rtr�r/r�r�r�rs rr�zDocument.__init__%s*�����"�*��������� $��rc��|jr|j|jf}n|j}|jj	|�Sr-)r�r�r�r�r')rr�r�s   rr�zDocument._get_elem_info.s?������&�&��(9�(9�9�C��/�/�C����"�"�3�'�'rc��|jSr-rVrs rrWzDocument._get_actualEncoding5rCrc��|jSr-)rtrs r�_get_doctypezDocument._get_doctype8r�rc��|jSr-)�documentURIrs r�_get_documentURIzDocument._get_documentURI;s�����rc��|jSr-rYrs rrZzDocument._get_encoding>r8rc��|jSr-)�errorHandlerrs r�_get_errorHandlerzDocument._get_errorHandlerAs��� � � rc��|jSr-)rrs r�_get_standalonezDocument._get_standaloneDr4rc��|jSr-)�strictErrorCheckingrs r�_get_strictErrorCheckingz!Document._get_strictErrorCheckingGs���'�'�'rc��|jSr-r\rs rr]zDocument._get_versionJr�rc��|j|jvr6tjj	t|��dt|�����|j�|jj|�|jtjk(r/|j�rtjj	d��tj||�S)Nr=z two document elements disallowed)r$rBrCrDrErFrGrHrrd�_get_documentElementrIrQs  rrIzDocument.appendChildMs����=�=�� 6� 6�6��'�'�-�-�.2�4�j�$�t�*�E�G�
G��?�?�&�
�O�O�'�'��-��=�=�D�-�-�-��(�(�*��'�'�-�-�2�4�
4�����d�+�+rc���	|jj|�dx|_|_d|_|j|urd|_	|S#t$rtjj��wxYwr-)
r/r]rKrCrDrLrPrQrG�documentElementr^s  rrHzDocument.removeChild]sr��	(��O�O�"�"�8�,�;?�>���x�7�"������8�+�#'�D� �����	(��'�'�%�%�'�'�	(�s�A	�	(A1c�h�|jD]#}|jtjk(s�!|cSyr-)r/r$rrdrQs  rr�zDocument._get_documentElementis'���O�O�D��}�}�� 1� 1�1���$rc��|j�!|jj�d|_tj|�yr-)rtrbrrs rrbzDocument.unlinkns/���<�<�#��L�L���!��D�L����D�rc��|sy|jjddd�}|j|_|j|_|j|_|j
D]s}t
|||�}|j
j|�|jtjk(rn$|jtjk(r||_||_
�u|jtj j"j$||�|Sr-)rnrvrrrrr/rircr$rr%rRrtrGr�rCrDrErF)rrkrKrJ�
childclones     rrlzDocument.cloneNodets������#�#�2�2�4��t�D��������?�?�������
����A�$�Q��e�4�J����#�#�J�/��"�"�d�&8�&8�8��$�$��(?�(?�?� *��
�$)�J�!�!�	
�$�$�S�W�W�%<�%<�%H�%H�%)�5�	2��rc�(�t�}||_|Sr-)r�rj)rr�s  r�createDocumentFragmentzDocument.createDocumentFragment�s���������rc�*�t|�}||_|Sr-)rlrj)rr�rMs   r�
createElementzDocument.createElement�s���G�������rc�l�t|t�std��t�}||_||_|S�Nznode contents must be a string)rrr>r�rarj)rra�ts   r�createTextNodezDocument.createTextNode�s2���$��$��<�=�=��F���������rc�l�t|t�std��t�}||_||_|Sr�)rrr>rrarj�rrarTs   r�createCDATASectionzDocument.createCDATASection�s2���$��$��<�=�=��N���������rc�*�t|�}||_|Sr-)rrjr�s   r�
createCommentzDocument.createComment�s���D�M������rc�,�t||�}||_|Sr-)r�rj)rr�ra�ps    r�createProcessingInstructionz$Document.createProcessingInstruction�s��!�&�$�/������rc�8�t|�}||_d|_|Sr)r�rjr�)rr��as   r�createAttributezDocument.createAttribute�s����K���������rc�J�t|�\}}t|||�}||_|Sr-)rrlrj)rr�r�r�r�rMs      rrszDocument.createElementNS�s+��$�]�3���	��M�<��8������rc�Z�t|�\}}t||||�}||_d|_|Sr)rr�rjr�)rr�r�r�r�r�s      r�createAttributeNSzDocument.createAttributeNS�s4��$�]�3���	����i��@���������rc�0�t||||�}||_|Sr-)rHrj)rr�r2r3rIrMs      r�_create_entityzDocument._create_entity�s���4��8�\�:������rc�.�t|||�}||_|Sr-)rGrj)rr�r2r3rJs     r�_create_notationzDocument._create_notation�s���T�8�X�.������rc���||jvr|j|S|js
|jsy|j}|�|jg}||_n|syd}|�r�|j�}|j
|jD�cgc]}|jtvr|��c}�|j|�}|�r.|jj�D�]}|jrb|j|j|j�s�7||j|j <|j |k(r|}�b|j"r�o�n|j%|j&�r:||j|j <|j |k(r|}��|j"r��n�|j(s��||j|j <|j |k(r|}��|j"dk(s��nenc|j"rW|jj�D]:}|j(s�||j|j <|j |k(s�9|}�<|�	|S|r���|Scc}w)Nr>)r�r�r�r�r��pop�extendr/r$rMr�r�rr�r�r�r�r�r�r�r�)rr*�stack�resultrUrgr�rus        r�getElementByIdzDocument.getElementById�s��
������>�>�"�%�%����4�#7�#7���%�%���=��)�)�*�E�$)�D�!�������9�9�;�D��L�L�T�_�_�I�_�E�"�^�^�/G�G� �_�I�
J��&�&�t�,�D��!�O�O�2�2�4�D��(�(��;�;�t�'8�'8�$�.�.�I�9=�D�N�N�4�:�:�6�#�z�z�R�/�)-��%)�%9�%9� %����4�9�9�-�59����t�z�z�2��:�:��+�%)�F�!%�!5�!5�!����59����t�z�z�2��:�:��+�%)�F�!�1�1�Q�6�!�'5�(�%�%� �O�O�2�2�4�D��{�{�59����t�z�z�2��:�:��+�%)�F�	5�
�!���
�O�N�
��IIs�Ic�,�t||t��Sr-r�rBs  rr�zDocument.getElementsByTagNames��.�t�T�8�:�F�Frc�.�t|||t��Sr-r�rEs   rr�zDocument.getElementsByTagNameNS
r�rc�:�|jj||�Sr-)rnrorps   rrszDocument.isSupporteds���"�"�-�-�g�w�?�?rc��|jtjk(rtjjd��|jtjk(rtjjd��t|||�S)Nzcannot import document nodesz!cannot import document type nodes)r$rr%rCrD�NotSupportedErrrRri)rrUrks   r�
importNodezDocument.importNodesa���=�=�D�.�.�.��'�'�)�)�*H�I�I�
�]�]�d�5�5�
5��'�'�)�)�*M�N�N��4��t�,�,rc��g}|r|jd|�d��|�|jd|rdnd�d��|jddj|��d|���|jD]}|j	||||��y)	Nz
encoding="r�zstandalone="�yes�noz<?xml version="1.0" rdr�)rcr�rr/r&)	rr+r)r�r*rr�declarationsrUs	         rr&zDocument.writexmls���������*�X�J�a� 8�9��!����,�
�u��.M�Q� O�P����+�C�H�H�\�,B�+C�2�d�V�L�M��O�O�D��M�M�&�&�)�T�:�$rc��|j|ur/tjjd|�d|j����|jt
jt
jfvrtjjd��|tk7r�d|vrV|jdd�\}}|dk(r�|tjjk7r�tjjd��|dk(rY|tjjk7r<|jt
jk(rtjjd��d}|}nd}d}|jt
jk(r,|j}|� |j}|j|�nd}||_||_||_||_|jt
jk(r	||_|S||_|�$|j-|�r|j/|�|S)	Nz3cannot rename nodes from other documents;
expected z,
found z8renameNode() only applies to element and attribute nodesr�r>r�zillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rjrCrDrpr$rrdrr�rr�rr�r�r�r�r�r�r�r�r�r�r|r�)rrJr�r�r�r�r��is_ids        r�
renameNodezDocument.renameNode(s����?�?�$�&��'�'�*�*�,0�!�/�/�C�D�
D�
�:�:�d�/�/��1D�1D�E�E��'�'�)�)�J�L�
L��?�*��d�{�$(�J�J�s�A�$6�!��	���'�&�#�'�'�*A�*A�A��'�'�.�.�7�9�9��g�o�&�#�'�'�*A�*A�A��*�*��(;�(;�;��'�'�.�.�>�@�@��� �	��F��I��:�:��,�,�,��n�n�G��"������+�+�A�.��G���� ���%�����
��:�:��*�*�*��A�I����A�F��"��(�(��+���.�.�q�1��r)rrrNN)=r�r�r�rrrdr�r�rRrBrgrnr%r$r�r�r�rGrQrPrJrrrrr�r�r�r�r�r�rWr�r�rZr�r�r�r]rIrHr�rbrlr�r�r�r�r�r�r�rsr�r�r�r�r�r�rsr�r&r�r
rrr{r{
sE��@�I��*�*�D�,L�,L��*�*�D�,C�,C�E��'�(�N��!�!�H��H��I��J��J�$(�(�O�k�
�N��H��J��G����L��K��O�%�(�#�� ��!��(��,� 
��
��*�
�
���
�
����
�
8�tG�7�@�-�KO� �;� 3rr{r�z#Top-level element of this document.c��
�|jj|�r%tjjj
}n$tjjj}|jtjk(r�|j|j|j�}|jj�D]j}|j|j|j|j �|j#|j|j$�}|j&|_�l|�r|j(D] }t+|||�}|j-|��"�n�|jtj.k(rD|j1�}|�r�|j(D] }t+|||�}|j-|��"�n�|jtj2k(r|j5|j6�}�nM|jtj8k(r|j;|j6�}�n|jtj<k(r(|j?|j@|j6�}�n�|jtjBk(r|jE|j6�}�n�|jtjFk(r@|jI|j|j�}d|_|j |_�n7|jtjJk(�r�tjjj}|jLjO|jP|jR|jT�}||_|�r�g|jV_,g|jZ_,|jZjXD]y}	t]|	j|	jR|	jT�}
||
_|jZjXj_|
�ta|	d�s�g|	jc||	|
��{|jVjXD]�}te|j|jR|jT|jf�}|jh|_4|jj|_5|jl|_6||_|jVjXj_|�ta|d�s��|jc|||���n+tjjodtq|�z��ta|d�r|jc|||�|S)zo
    Clone a node and give it the new owner document.
    Called by Node.cloneNode and Document.importNode
    Tr�zCannot clone node %s)9rjryrCrDrErF�
NODE_IMPORTEDr$rrdrsr�r�r�rr�r�r�r�r�r/rirIr?r�r`r�rar�r�r�r�r�r�r�rr�rRrnrxr�r2r3r>rr?rGrcr�r�rHrIrJrrrr�rF)
rUrk�newOwnerDocumentr�rKrur�rgrTrJrLrMrNs
             rririas���
���$�$�%5�6��G�G�+�+�7�7�	��G�G�+�+�9�9�	��}�}��)�)�)� �0�0��1B�1B�15���@���O�O�*�*�,�D�� � ��!2�!2�D�M�M�4�:�:�N��(�(��):�):�D�N�N�K�A��.�.�A�K�-�
�������t�-=�>���!�!�!�$�)�
���$�5�5�	5� �7�7�9���������t�-=�>���!�!�!�$�)�
���$�.�.�	(� �/�/��	�	�:��	
���$�1�1�	1� �3�3�D�I�I�>��	
���$�:�:�	:� �<�<�T�[�[�=A�Y�Y�H��	
���$�+�+�	+� �.�.�t�y�y�9��	
���$�-�-�	-� �2�2�4�3D�3D�37�=�=�B������j�j���	
���$�1�1�	1��G�G�+�+�9�9�	� �/�/�B�B��I�I�t�}�}�d�m�m�5��.����"$�E�N�N��#%�E�O�O� ��^�^�(�(��#�A�J�J��
�
�A�J�J�G��)9��&����$�$�+�+�H�5��1�7�8��-�-�i��H�E�)��]�]�'�'����
�
�A�J�J��
�
� !���0��()�(8�(8��%�"#�*�*���!"�����'7��$����#�#�*�*�6�2��1�7�8��-�-�i��F�C�(��g�g�%�%�&<�t�D�z�&I�J�J�
�t�.�/��$�$�Y��e�<��Lrc�T�|jdd�}t|�dk(r|Sd|dfS)Nr�r>�r)r�r)r��fieldss  rrr�s4��
�
 �
 ��a�
(�F�
�6�{�a���
��f�Q�i� � rc�~�||i|��}|j�\}}|j|�|j�|Sr-)�getEvent�
expandNoder�)�func�args�kwargs�events�toktype�rootNodes      r�_do_pulldom_parser��s>��
�4�
"�6�
"�F����)��G�X�
���h��
�L�L�N��Orc�z�|�|sddlm}|j|�Sddlm}t	|j|f||d��S)z3Parse a file into a DOM by filename or file object.r��expatbuilder��pulldom)�parser�bufsize)�xml.domr��parser�r�)�filer�r�r�r�s     rr�r��s?��
�~�g�(��!�!�$�'�'�#� �������'�2�4�	4rc�t�|�ddlm}|j|�Sddlm}t	|j|fd|i�S)z&Parse a file into a DOM from a string.rr�r�r�)r�r��parseStringr�r�)�stringr�r�r�s    rr�r��s?��
�~�(��'�'��/�/�#� ��!4�!4�v�i�"*�F�!3�5�	5rc���|rQt|t�rtj|�}|D]'\}}tj
j
||�r�'ytj
Sr-)rrr�_parse_feature_stringr{rnro)�features�f�vs   r�getDOMImplementationr��sT����h��$��3�3�H�=�H��D�A�q��*�*�5�5�a��;����"�"�"rr�r-)7r[r r�rCrrrr�xml.dom.minicompat�xml.dom.xmlbuilderrr	rDrrdr�rM�defpropertyrXr�r�r�r�r�r��objectr
�
AttributeListr_rrlr�r�r�r�r�rr�rrrr0r<rHrGrgr}rNr{rirr�r�r�r�r
rr�<module>rs����"
��J�J� �>� �G�G�L�L�5�5��G�G�L�L�>�>�@��t�3�7�7�<�<�t�l�D�,�$@�A��D�+�$?�@��D�+�$H�I������%�t�%�$y8�4�y8�v�D�&�$F�G��D�+�$M�N��D�,�$E�F�a?�6�a?�F�L�(�6�8��
��v��(�D�$���L"�d�L"�\�G�\�<�>��G�[�7�9�	 �&;�&;�RN�I�t�N�4EC�I�t�EC�N�M�8�)E�F�S+�=�S+�j�D�0�.�/��D�+�@�B���B�m�B�	3�4�	3�<�V�<�|�*�H�8�:�
�
�:�:�y�$�:�x&9�Z��&9�P8�z�9�d�8�M�+�M�^(�&�(�T2�Q�t�Z�Q�f
�H�'�5�7�O�d!��4�5�#r

?>