Your IP : 3.144.117.52


Current Path : /opt/alt/python39/lib64/python3.9/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/xml/dom/__pycache__/minidom.cpython-39.opt-2.pyc

a

R�f�	�@s�ddlZddlZddlmZmZmZmZddlTddlm	Z	m
Z
ejjj
ejjjfZGdd�dejj�Zeeddd	�eed
dd	�eedd
d	�dd�Zdd�Zdd�Zdd�Zdd�ZGdd�de�ZGdd�de�Zeeddd	�eeddd	�eedd d	�Gd!d"�d"e�Zeed#d$d	�eZGd%d&�d&e�Zedd�ZGd'd(�d(e�Zeed)d*d	�eedd+d	�d,d-�ZGd.d/�d/�ZGd0d1�d1ee�Z Gd2d3�d3ee�Z!ee!d#d4d	�Gd5d6�d6e!�Z"ee"d7d8d	�ee"d9d:d	�d;d<�Z#d=d>�Z$Gd?d@�d@e!�Z%GdAdB�dBe"�Z&GdCdD�dDe�Z'ee'd#dEd	�GdFdG�dG�Z(GdHdI�dIe(ee�Z)GdJdK�dKe(e�Z*GdLdM�dMe(ee�Z+GdNdO�dOe	�Z,GdPdQ�dQe�Z-dRdS�Z.GdTdU�dUee
�Z/ee/dVdWd	�dXdY�Z0dZd[�Z1d\d]�Z2ddd^d_�Z3ded`da�Z4dfdbdc�Z5dS)g�N)�EMPTY_NAMESPACE�EMPTY_PREFIX�XMLNS_NAMESPACE�domreg)�*)�DOMImplementationLS�
DocumentLSc@s�eZdZdZdZdZdZdZeZ	dd�Z
d2dd�Zd3dd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Z dS)4�NodeNcCsdS)NT���selfr
r
�4/opt/alt/python39/lib64/python3.9/xml/dom/minidom.py�__bool__+sz
Node.__bool__cCs|�dd||�S�N�)�toprettyxml)r�encoding�
standaloner
r
r
�toxml.sz
Node.toxml�	�
cCsz|durt��}ntjt��|ddd�}|jtjkrJ|�|d||||�n|�|d||�|durj|��S|�	���SdS)N�xmlcharrefreplacer)r�errors�newliner)
�io�StringIO�
TextIOWrapper�BytesIO�nodeTyper	�
DOCUMENT_NODE�writexml�getvalue�detach)r�indent�newlrr�writerr
r
r
r1s

�zNode.toprettyxmlcCs
t|j�S�N)�bool�
childNodesrr
r
r
�
hasChildNodesDszNode.hasChildNodescCs|jSr&�r(rr
r
r
�_get_childNodesGszNode._get_childNodescCs|jr|jdSdS�Nrr*rr
r
r
�_get_firstChildJszNode._get_firstChildcCs|jr|jdSdS�N���r*rr
r
r
�_get_lastChildNszNode._get_lastChildcCs|j|jkr,t|j�D]}|�||�q|S|j|jvrTtj�dt	|�t	|�f��|j
durj|j
�|�|dur~|�|�n�z|j�
|�}Wnty�tj���Yn0|jtvr�t|�|j�||�||_||_|r�|j|d}||_||_nd|_||_
|S)N�%s cannot be child of %s�)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�cr>�noder
r
r
r5Rs8�

zNode.insertBeforecCs�|j|jkr*t|j�D]}|�|�q|S|j|jvrTtj�dt	|�t	|�f��n|jt
vrft|�|jdur||j�
|�t||�d|_|S�Nr1)rr3r4r(r=r6r7r8r9r:rArBr;r<�
_append_childrD)rrIrHr
r
r
r=rs�


zNode.appendChildcCs|j|jkr(|j}|�|�|�||�S|j|jvrPtj�dt	|�t	|�f��||ur\dS|j
durr|j
�|�z|j�|�}Wnt
y�tj���Yn0||j|<||_
d|_
|jtvs�|jtvr�t|�|j|_|j|_d|_d|_|jr�||j_|j�r||j_|SrJ)rr3rDr<r5r6r7r8r9r:r;r(r>r?r@rArBrE)rrF�oldChildrGr>r
r
r
�replaceChild�s@
�


�zNode.replaceChildcCs~z|j�|�Wnty,tj���Yn0|jdurB|j|j_|jdurV|j|j_d|_|_|jt	vrtt
|�d|_|Sr&)r(�remover?r7r8r@rDrErrArBr;�rrLr
r
r
r<�s




zNode.removeChildcCs�g}|jD]�}|jtjkr�|jsJ|r0|j|d_|jr@|j|j_|��q�|r�|dj|jkr�|d}|j|j|_|j|_|jr�||j_|��q�|�|�q
|�|�|jtj	kr
|�
�q
||jdd�<dSr.)r(rr	�	TEXT_NODE�datarDrE�unlink�append�ELEMENT_NODE�	normalize)r�L�childrIr
r
r
rU�s*





zNode.normalizecCst|||jp|�Sr&)�_clone_node�
ownerDocument)r�deepr
r
r
�	cloneNode�szNode.cloneNodecCs|jj�||�Sr&)rY�implementation�
hasFeature�r�feature�versionr
r
r
�isSupported�szNode.isSupportedcCsdSr&r
rr
r
r
�_get_localName�szNode._get_localNamecCs||uSr&r
�r�otherr
r
r
�
isSameNode�szNode.isSameNodecCs|�|d�r|SdSdSr&)ra�rr_r
r
r
�getInterface�szNode.getInterfacec	Cs.z|j|dWSttfy(YdS0dSr,)�
_user_data�AttributeError�KeyError�r�keyr
r
r
�getUserData�szNode.getUserDatacCsld}z
|j}Wnty*i}||_Yn0||vr@||d}|dur\d}|durh||=n||f||<|Sr,)rhri)rrlrQ�handler�old�dr
r
r
�setUserData�s
zNode.setUserDatacCsDt|d�r@t|j���D]&\}\}}|dur|�|||||�qdS)Nrh)�hasattr�listrh�itemsZhandle)r�	operation�srcZdstrlrQrnr
r
r
�_call_user_data_handler�s
zNode._call_user_data_handlercCs>d|_|_|jr.|jD]}|��qt�|_d|_d|_dSr&)r;rYr(rR�NodeListrErD)rrWr
r
r
rRs

zNode.unlinkcCs|Sr&r
rr
r
r
�	__enter__szNode.__enter__cCs|��dSr&)rR)rZetZev�tbr
r
r
�__exit__sz
Node.__exit__)NN)rrNN)!�__name__�
__module__�__qualname__�namespaceURIr;rYrDrEr�prefixrrrr)r+r-r0r5r=rMr<rUr[rarbrergrmrqrwrRryr{r
r
r
r
r	"s>
�
  
r	�
firstChildzFirst child node, or None.)�doc�	lastChildzLast child node, or None.�	localNamez"Namespace-local name of this node.cCs2|j}|r|d}||_||_|�|�||_dSr.)r(rErDrSr;)rrIr(Zlastr
r
r
rKs
rKcCs$|dur |jtjkrdS|j}qdS�NTF)rr	rr;�rIr
r
r
�_in_document's
r�cCs6|r2|�dd��dd��dd��dd�}|�|�dS)	N�&z&amp;�<z&lt;�"z&quot;�>z&gt;)�replace�write)r%rQr
r
r
�_write_data/s��r�cCsD|jD]8}|jtjkr2|dks(|j|kr2|�|�t|||�q|S�Nr)r(rr	rT�tagNamerS�_get_elements_by_tagName_helper)�parent�name�rcrIr
r
r
r�6s
��
r�cCsX|jD]L}|jtjkr|dks(|j|krD|dks:|j|krD|�|�t||||�q|Sr�)r(rr	rTr�rrS�"_get_elements_by_tagName_ns_helper)r�ZnsURIr�r�rIr
r
r
r�>s
��
r�c@sJeZdZejZdZdZdZdZ	ej
ejejej
ejejejfZdd�ZdS)�DocumentFragmentz#document-fragmentNcCst�|_dSr&)rxr(rr
r
r
�__init__UszDocumentFragment.__init__)r|r}r~r	r3r�nodeName�	nodeValue�
attributesr;rTrP�CDATA_SECTION_NODE�ENTITY_REFERENCE_NODE�PROCESSING_INSTRUCTION_NODE�COMMENT_NODE�
NOTATION_NODEr6r�r
r
r
r
r�Gs�r�c@s�eZdZdZejZdZdZdZ	ej
ejfZe
ddfdd�Zdd�Zdd	�Zd
d�Zdd
�Zeee�ZZdd�Zdd�Zeee�ZZdd�Zdd�Zeee�Zdd�Zdd�Zdd�ZdS)�Attr)�_name�_valuer�_prefixr(�
_localNamerY�ownerElementNFcCs2d|_||_||_||_t�|_|j�t��dSr&)r�r�rr�rxr(rS�Text)r�qNamerr�r�r
r
r
r�csz
Attr.__init__cCs2z|jWSty,|j�dd�dYS0dS�N�:r2r/)r�rir��splitrr
r
r
rbpszAttr._get_localNamecCs|jSr&)�	specifiedrr
r
r
�_get_specifiedvszAttr._get_specifiedcCs|jSr&)r�rr
r
r
�	_get_nameyszAttr._get_namecCs||_|jdurt|j�dSr&)r�r�rB�r�valuer
r
r
�	_set_name|s
zAttr._set_namecCs|jSr&)r�rr
r
r
�
_get_value�szAttr._get_valuecCs6||_||jd_|jdur&t|j�||jd_dSr,)r�r(rQr�rBr�r
r
r
�
_set_value�s


zAttr._set_valuecCs|jSr&)r�rr
r
r
�_get_prefix�szAttr._get_prefixcCsd|j}|dkr&|r&|tkr&tj�d��||_|dur<|j}nd||jf}|jrZt|j�||_	dS)N�xmlnsz5illegal use of 'xmlns' prefix for the wrong namespacez%s:%s)
rrr7r8�NamespaceErrr�r�r�rBr�)rr�ZnsuriZnewNamer
r
r
�_set_prefix�s�
zAttr._set_prefixcCsv|j}|durR|j|j=|j|j|jf=|jrRd|_|jd8_|jj	d8_	|j
D]}|��qX|j
dd�=dS)NFr2)r��_attrsr��_attrsNSrr��_is_id�_magic_id_nodesrY�_magic_id_countr(rR)r�elemrWr
r
r
rR�s


zAttr.unlinkcCsf|jr
dS|j}|j}|dus&|dur*dS|�|�}|dur@dS|jrV|�|j|j�S|�|j�SdSr�)	r�rYr��_get_elem_infor�isIdNSr��isIdr��rr�r��infor
r
r
�	_get_isId�s
zAttr._get_isIdcCs\|j}|j}|dus|dur tS|�|�}|dur6tS|jrL|�|j|j�S|�|j�SdSr&)	rYr��_no_typer�r�getAttributeTypeNSr��getAttributeTyper�r�r
r
r
�_get_schemaType�s
zAttr._get_schemaType) r|r}r~�	__slots__r	�ATTRIBUTE_NODErr�r�r�rPr�r6rr�rbr�r�r��propertyr�r�r�r�r�r�r�r�r�rRr�r�r
r
r
r
r�Ys.�


r�r�z True if this attribute is an ID.z'Namespace-local name of this attribute.�
schemaTypezSchema type for this attribute.c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zd9dd�Z
eZdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�ZdS):�NamedNodeMap�r�r��
_ownerElementcCs||_||_||_dSr&r�)r�attrsZattrsNSr�r
r
r
r��szNamedNodeMap.__init__cCs
t|j�Sr&)�lenr�rr
r
r
�_get_length�szNamedNodeMap._get_lengthcCs2z|t|j���|WSty,YdS0dSr&)rsr��keys�
IndexError�rr>r
r
r
�item�szNamedNodeMap.itemcCs*g}|j��D]}|�|j|jf�q|Sr&)r��valuesrSr�r��rrVrIr
r
r
rt�szNamedNodeMap.itemscCs0g}|j��D]}|�|j|jf|jf�q|Sr&)r�r�rSrr�r�r�r
r
r
�itemsNS�szNamedNodeMap.itemsNScCs"t|t�r||jvS||jvSdSr&)�
isinstance�strr�r�rkr
r
r
�__contains__�s

zNamedNodeMap.__contains__cCs
|j��Sr&)r�r�rr
r
r
r�szNamedNodeMap.keyscCs
|j��Sr&)r�r�rr
r
r
�keysNSszNamedNodeMap.keysNScCs
|j��Sr&)r�r�rr
r
r
r�szNamedNodeMap.valuesNcCs|j�||�Sr&�r��get)rr�r�r
r
r
r�szNamedNodeMap.getcCs:|jt|dd�urdSt|�t|�kt|�t|�kSdS)Nr�r)r��getattr�idrcr
r
r
�_cmpszNamedNodeMap._cmpcCs|�|�dkSr,�r�rcr
r
r
�__eq__szNamedNodeMap.__eq__cCs|�|�dkSr,r�rcr
r
r
�__ge__szNamedNodeMap.__ge__cCs|�|�dkSr,r�rcr
r
r
�__gt__szNamedNodeMap.__gt__cCs|�|�dkSr,r�rcr
r
r
�__le__szNamedNodeMap.__le__cCs|�|�dkSr,r�rcr
r
r
�__lt__"szNamedNodeMap.__lt__cCs"t|t�r|j|S|j|SdSr&)r�r4r�r�)r�attname_or_tupler
r
r
�__getitem__%s

zNamedNodeMap.__getitem__cCstt|t�rPz|j|}Wn.tyFt|�}|jj|_|�|�Yn0||_n t|t�sbt	d��|}|�|�dS)Nz%value must be a string or Attr object)
r�r�r�rjr�r�rY�setNamedItemr��	TypeError)r�attnamer�rIr
r
r
�__setitem__,s


zNamedNodeMap.__setitem__cCs&z|j|WSty YdS0dSr&)r�rj�rr�r
r
r
�getNamedItem;szNamedNodeMap.getNamedItemcCs*z|j||fWSty$YdS0dSr&)r�rj�rrr�r
r
r
�getNamedItemNSAszNamedNodeMap.getNamedItemNScCsX|�|�}|durJt|j�|j|j=|j|j|jf=t|d�rFd|_	|St
j���dS�Nr�)
r�rBr�r�r�r�rr�rrr�r7r8r@�rr��nr
r
r
�removeNamedItemGs



zNamedNodeMap.removeNamedItemcCsZ|�||�}|durLt|j�|j|j|jf=|j|j=t|d�rHd|_	|St
j���dSr�)
r�rBr�r�rr�r�r�rrr�r7r8r@�rrr�r�r
r
r
�removeNamedItemNSSs


zNamedNodeMap.removeNamedItemNScCstt|t�s&tj�dt|�t|�f��|j�|j�}|r@|�	�||j|j<||j
|j|jf<|j
|_t|j�|SrJ)r�r�r7r8r9r:r�r�r�rRr�rr�r�r�rB)rrIror
r
r
r�_s
�
zNamedNodeMap.setNamedItemcCs
|�|�Sr&)r��rrIr
r
r
�setNamedItemNSlszNamedNodeMap.setNamedItemNScCs||}t|j�|��dSr&)rBr�rR)rr�rIr
r
r
�__delitem__os
zNamedNodeMap.__delitem__cCs|j|j|jfSr&r�rr
r
r
�__getstate__tszNamedNodeMap.__getstate__cCs|\|_|_|_dSr&r��r�stater
r
r
�__setstate__wszNamedNodeMap.__setstate__)N) r|r}r~r�r�r�r�rtr�r�r�r�r�r��__len__r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
r
r��s:	

r�Zlengthz$Number of nodes in the NamedNodeMap.c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�TypeInfo��	namespacer�cCs||_||_dSr&r)rrr�r
r
r
r��szTypeInfo.__init__cCs2|jrd|jj|j|jfSd|jj|jfSdS)Nz<%s %r (from %r)>z<%s %r>)r�	__class__r|r�rr
r
r
�__repr__�s
�zTypeInfo.__repr__cCs|jSr&)r�rr
r
r
r��szTypeInfo._get_namecCs|jSr&)rrr
r
r
�_get_namespace�szTypeInfo._get_namespaceN)r|r}r~r�r�rr�rr
r
r
r
r��s
r�c@s eZdZdZejZdZeZ	dZ
ejejejej
ejejfZeddfdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZeZdd�Zdd�Z d d!�Z!e!Z"d"d#�Z#d$d%�Z$d&d'�Z%d(d)�Z&d*d+�Z'd9d-d.�Z(d/d0�Z)d1d2�Z*d3d4�Z+d5d6�Z,d7d8�Z-dS):�Element)rYr;r�r�r�rr�r(r�r�rDrENrcCsBd|_||_|_||_||_t�|_d|_|_d|_	d|_
dSr&)r;r�r�r�rrxr(rDrEr�r�)rr�rr�r�r
r
r
r��s
zElement.__init__cCs|jduri|_i|_dSr&)r�r�rr
r
r
�_ensure_attributes�s
zElement._ensure_attributescCs2z|jWSty,|j�dd�dYS0dSr�)r�rir�r�rr
r
r
rb�szElement._get_localNamecCs|jSr&�r�rr
r
r
�_get_tagName�szElement._get_tagNamecCs@|jdur&t|j���D]}|��qd|_d|_t�|�dSr&)r�rsr�rRr�r	)r�attrr
r
r
rR�s

zElement.unlinkcCs6|jdurdSz|j|jWSty0YdS0dSr)r�r�rj)rr�r
r
r
�getAttribute�s	
zElement.getAttributecCs:|jdurdSz|j||fjWSty4YdS0dSr)r�r�rjr�r
r
r
�getAttributeNS�s
zElement.getAttributeNScCsV|�|�}|dur4t|�}||_|j|_|�|�n||jkrR||_|jrRt|�dSr&)�getAttributeNoder�r�rY�setAttributeNoder�rB)rr�r�r	r
r
r
�setAttribute�s

zElement.setAttributecCs�t|�\}}|�||�}|durHt||||�}||_|j|_|�|�n4||jkrf||_|jrft|�|j|kr|||_||_	dSr&)
�_nssplit�getAttributeNodeNSr�r�rYr
r�rBr�r�)rr�
qualifiedNamer�r��	localnamer	r
r
r
�setAttributeNS�s

zElement.setAttributeNScCs|jdurdS|j�|�Sr&r�)r�attrnamer
r
r
rs
zElement.getAttributeNodecCs|jdurdS|j�||f�Sr&)r�r�r�r
r
r
rs
zElement.getAttributeNodeNScCs�|jd|fvrtj�d��|��|j�|jd�}|durD|�|�|j	�|j
|jfd�}|durt||urt|�|�t||�||ur�|S||ur�|SdS)Nzattribute node already owned)
r�r7r8ZInuseAttributeErrrr�r�r��removeAttributeNoder�rr��_set_attribute_node)rr	Zold1Zold2r
r
r
r
s


zElement.setAttributeNodecCsN|jdurtj���z|j|}Wnty>tj���Yn0|�|�dSr&)r�r7r8r@r�rjr)rr�r	r
r
r
�removeAttribute%s

zElement.removeAttributecCsR|jdurtj���z|j||f}WntyBtj���Yn0|�|�dSr&)r�r7r8r@rjr)rrr�r	r
r
r
�removeAttributeNS.s

zElement.removeAttributeNScCs\|durtj���z|j|jWnty>tj���Yn0t|�|��|j|_|Sr&)	r7r8r@r�r�rjrBrRrYr�r
r
r
r7s
zElement.removeAttributeNodecCs|jdurdS||jvS�NF�r�r�r
r
r
�hasAttributeGs
zElement.hasAttributecCs|jdurdS||f|jvSr)r�r�r
r
r
�hasAttributeNSQs
zElement.hasAttributeNScCst||t��Sr&�r�rxr�r
r
r
�getElementsByTagNameVszElement.getElementsByTagNamecCst|||t��Sr&�r�rxr�r
r
r
�getElementsByTagNameNS^s
�zElement.getElementsByTagNameNScCsd|jt|�fS)Nz<DOM Element: %s at %#x>)r�r�rr
r
r
rbszElement.__repr__rcCs�|�|d|j�|��}|��D],}|�d|�t|||j�|�d�q$|jr�|�d�t|j�dkr�|jdjt	j
t	jfvr�|jd�|ddd�n4|�|�|jD]}|�|||||�q�|�|�|�d|j|f�n|�d	|�dS)
Nr�z %s="r�r�r2rrz</%s>%sz/>%s)
r�r��_get_attributesr�r�r�r(r�rr	rPr�r )rr%r#�	addindentr$r�Za_namerIr
r
r
r es(	

��


zElement.writexmlcCs|��t|j|j|�Sr&)rr�r�r�rr
r
r
r!�szElement._get_attributescCs|jr
dSdSdSr�rrr
r
r
�
hasAttributes�szElement.hasAttributescCs|�|�}|�|�dSr&)r�setIdAttributeNode)rr��idAttrr
r
r
�setIdAttribute�s
zElement.setIdAttributecCs|�||�}|�|�dSr&)rr$)rrr�r%r
r
r
�setIdAttributeNS�szElement.setIdAttributeNScCsj|dus|�|j�stj���t|�dur4tj���|jsfd|_|jd7_|j	j
d7_
t|�dS)NTr2)rer�r7r8r@�_get_containing_entref�NoModificationAllowedErrr�r�rYr�rB)rr%r
r
r
r$�s

zElement.setIdAttributeNode)rrr).r|r}r~r�r	rTrr�r�r�r�r�r�rPr�r�r6rr�rrbrrRr
rrrrrr
ZsetAttributeNodeNSrrrZremoveAttributeNodeNSrrrr rr r!r#r&r'r$r
r
r
r
r�sT��
		

 rr�z*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.cCs8t|�|��||j|j<||j|j|jf<||_dSr&)rBrr�r�r�rr�r�)�elementr	r
r
r
r�s
rc@sbeZdZdZdZe�ZdZdZdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�ZdS)�	Childlessr
NcCsdSr&r
rr
r
r
r-�szChildless._get_firstChildcCsdSr&r
rr
r
r
r0�szChildless._get_lastChildcCstj�|jd��dS)Nz nodes cannot have children�r7r8r9r�r�r
r
r
r=�s�zChildless.appendChildcCsdSrr
rr
r
r
r)�szChildless.hasChildNodescCstj�|jd��dS�Nz nodes do not have childrenr,�rrFrGr
r
r
r5�s�zChildless.insertBeforecCstj�|jd��dSr-)r7r8r@r�rOr
r
r
r<�s�zChildless.removeChildcCsdSr&r
rr
r
r
rU�szChildless.normalizecCstj�|jd��dSr-r,�rrFrLr
r
r
rM�s�zChildless.replaceChild)r|r}r~r�r�Z
EmptyNodeListr(r�r�r-r0r=r)r5r<rUrMr
r
r
r
r+�sr+c@s\eZdZejZdZdd�Zdd�Zdd�Z	e
ee	�Zdd	�Zd
d�Z
e
ee
�Zdd
d�ZdS)�ProcessingInstruction��targetrQcCs||_||_dSr&r1)rr2rQr
r
r
r��szProcessingInstruction.__init__cCs|jSr&�rQrr
r
r
�_get_nodeValue�sz$ProcessingInstruction._get_nodeValuecCs
||_dSr&r3r�r
r
r
�_set_nodeValue�sz$ProcessingInstruction._set_nodeValuecCs|jSr&�r2rr
r
r
�
_get_nodeName�sz#ProcessingInstruction._get_nodeNamecCs
||_dSr&r6r�r
r
r
�
_set_nodeName�sz#ProcessingInstruction._set_nodeNamercCs|�d||j|j|f�dS)Nz
%s<?%s %s?>%s)r�r2rQ�rr%r#r"r$r
r
r
r �szProcessingInstruction.writexmlN)rrr)r|r}r~r	r�rr�r�r4r5r�r�r7r8r�r r
r
r
r
r0�s

r0c@sreZdZdZdd�Zdd�ZeZdd�Zdd	�Ze	ee�Z
Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�ZdS)�
CharacterData)�_datarYr;rErDcCs,d|_|_d|_|_d|_t�|�dSr)rYr;rErDr;r	r�rr
r
r
r��szCharacterData.__init__cCs
t|j�Sr&)r�rQrr
r
r
r�szCharacterData._get_lengthcCs|jSr&�r;rr
r
r
�	_get_dataszCharacterData._get_datacCs
||_dSr&r<�rrQr
r
r
�	_set_dataszCharacterData._set_datacCs6|j}t|�dkrd}nd}d|jj|dd�|fS)N�
z...rz<DOM %s node "%r%s">r)rQr�rr|)rrQZ	dotdotdotr
r
r
rs�zCharacterData.__repr__cCsT|dkrtj�d��|t|j�kr.tj�d��|dkrBtj�d��|j|||�S�Nr�offset cannot be negative�#offset cannot be beyond end of data�count cannot be negative�r7r8�IndexSizeErrr�rQ�r�offset�countr
r
r
�
substringDataszCharacterData.substringDatacCs|j||_dSr&r3)r�argr
r
r
�
appendDataszCharacterData.appendDatacCsZ|dkrtj�d��|t|j�kr.tj�d��|rVd|jd|�||j|d�f|_dS)NrrBrC�%s%s%srE)rrHrKr
r
r
�
insertData!s�zCharacterData.insertDatacCsl|dkrtj�d��|t|j�kr.tj�d��|dkrBtj�d��|rh|jd|�|j||d�|_dSrArErGr
r
r
�
deleteData*szCharacterData.deleteDatacCsr|dkrtj�d��|t|j�kr.tj�d��|dkrBtj�d��|rnd|jd|�||j||d�f|_dS)NrrBrCrDrMrE)rrHrIrKr
r
r
�replaceData4s�zCharacterData.replaceDataN)r|r}r~r�r�r�r�r=r?r�rQr�rrJrLrNrOrPr
r
r
r
r:�s			
r:zLength of the string data.c@sHeZdZdZejZdZdZdd�Z	ddd�Z
d	d
�Zdd�Zd
d�Z
dS)r�r
z#textNcCs�|dks|t|j�kr"tj�d��|��}|j|d�|_|j|_|j}|jr~||jj	vr~|durp|j�
|�n|j�||�|jd|�|_|S)Nrzillegal offset value)r�rQr7r8rFrrYrDr;r(r=r5)rrHZnewText�nextr
r
r
�	splitTextIszText.splitTextrcCst|d||j|f�dS)NrM)r�rQr9r
r
r
r Xsz
Text.writexmlcCs�|jg}|j}|durB|jtjtjfvrB|�d|j�|j}qqBq|j}|durz|jtjtjfvrz|�|j�|j}qHqzqHd�	|�S)Nrr)
rQrErr	rPr�rCrDrS�join)rrVr�r
r
r
�_get_wholeText]szText._get_wholeTextcCs�|j}|j}|dur@|jtjtjfvr@|j}|�|�|}qq@q|j}|sT|�|�|dur�|jtjtjfvr�|j}|�|�|}qTq�qT|r�||_|SdSdSr&)	r;rErr	rPr�r<rDrQ)rZcontentr�r�rQr
r
r
�replaceWholeTextos*


zText.replaceWholeTextcCsF|j��rdSt|�}|dur"dS|j�|�}|dur:dS|��SdSr)rQ�strip�_get_containing_elementrYr��isElementContent)rr�r�r
r
r
�!_get_isWhitespaceInElementContent�s
z&Text._get_isWhitespaceInElementContent)rrr)r|r}r~r�r	rPrr�r�rRr rTrUrYr
r
r
r
r�Bs
r�ZisWhitespaceInElementContentzKTrue iff this text node contains only whitespace and is in element content.Z	wholeTextz.The text of all logically-adjacent text nodes.cCs*|j}|dur&|jtjkr|S|j}qdSr&)r;rr	rT�rIrHr
r
r
rW�srWcCs*|j}|dur&|jtjkr|S|j}qdSr&)r;rr	r�rZr
r
r
r(�sr(c@s(eZdZejZdZdd�Zddd�ZdS)	�Commentz#commentcCst�|�||_dSr&)r:r�r;r>r
r
r
r��s
zComment.__init__rcCs,d|jvrtd��|�d||j|f�dS)Nz--z%'--' is not allowed in a comment nodez
%s<!--%s-->%s)rQr?r�r9r
r
r
r �s
zComment.writexmlN)rrr)	r|r}r~r	r�rr�r�r r
r
r
r
r[�sr[c@s$eZdZdZejZdZddd�ZdS)�CDATASectionr
z#cdata-sectionrcCs,|j�d�dkrtd��|�d|j�dS)Nz]]>rz$']]>' not allowed in a CDATA sectionz<![CDATA[%s]]>)rQ�findr?r�r9r
r
r
r �szCDATASection.writexmlN)rrr)	r|r}r~r�r	r�rr�r r
r
r
r
r\�sr\c@szeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ReadOnlySequentialNamedNodeMap��_seqr
cCs
||_dSr&r_)r�seqr
r
r
r��sz'ReadOnlySequentialNamedNodeMap.__init__cCs
t|j�Sr&�r�r`rr
r
r
r��sz&ReadOnlySequentialNamedNodeMap.__len__cCs
t|j�Sr&rbrr
r
r
r��sz*ReadOnlySequentialNamedNodeMap._get_lengthcCs"|jD]}|j|kr|SqdSr&)r`r�r�r
r
r
r��s

z+ReadOnlySequentialNamedNodeMap.getNamedItemcCs,|jD] }|j|kr|j|kr|SqdSr&)r`rr�r�r
r
r
r��s
z-ReadOnlySequentialNamedNodeMap.getNamedItemNScCs4t|t�r|j|�}n
|�|�}|dur0t|��|Sr&)r�r4r�r�rj)rZ
name_or_tuplerIr
r
r
r��s

z*ReadOnlySequentialNamedNodeMap.__getitem__cCs2|dkrdSz|j|WSty,YdS0dSr,)r`r�r�r
r
r
r��sz#ReadOnlySequentialNamedNodeMap.itemcCstj�d��dS�Nz"NamedNodeMap instance is read-only�r7r8r)r�r
r
r
r��s�z.ReadOnlySequentialNamedNodeMap.removeNamedItemcCstj�d��dSrcrdr�r
r
r
r��s�z0ReadOnlySequentialNamedNodeMap.removeNamedItemNScCstj�d��dSrcrdr�r
r
r
r��s�z+ReadOnlySequentialNamedNodeMap.setNamedItemcCstj�d��dSrcrdr�r
r
r
r��s�z-ReadOnlySequentialNamedNodeMap.setNamedItemNScCs|jgSr&r_rr
r
r
r�sz+ReadOnlySequentialNamedNodeMap.__getstate__cCs|d|_dSr,r_r�r
r
r
r�sz+ReadOnlySequentialNamedNodeMap.__setstate__N)r
)r|r}r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r
r
r
r^�s
	r^z&Number of entries in the NamedNodeMap.c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
Identified��publicId�systemIdcCs||_||_dSr&rf)rrgrhr
r
r
�_identified_mixin_initsz!Identified._identified_mixin_initcCs|jSr&)rgrr
r
r
�
_get_publicIdszIdentified._get_publicIdcCs|jSr&)rhrr
r
r
�
_get_systemIdszIdentified._get_systemIdN)r|r}r~r�rirjrkr
r
r
r
resrec@sHeZdZejZdZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dd	d
�ZdS)�DocumentTypeNcCs2t�|_t�|_|r&t|�\}}||_|j|_dSr&)r^�entities�	notationsrr�r�)rrr�rr
r
r
r�"szDocumentType.__init__cCs|jSr&)�internalSubsetrr
r
r
�_get_internalSubset*sz DocumentType._get_internalSubsetcCs�|jdur�td�}|j|_|j|_tjjj}|r�g|j_	g|j
_	|j
j	D]2}t|j|j|j
�}|j
j	�|�|�|||�qH|jj	D]N}t|j|j|j
|j�}|j|_|j|_|j|_|jj	�|�|�|||�q�|�|||�|SdSdSr&)rYrlr�r�r7r8�UserDataHandler�NODE_CLONEDrmr`rn�NotationrgrhrSrw�Entity�notationName�actualEncodingrr`)rrZ�clonerur��notation�e�entityr
r
r
r[-s0

�zDocumentType.cloneNodercCs�|�d�|�|j�|jr8|�d||j||jf�n|jrR|�d||jf�|jdur||�d�|�|j�|�d�|�d|�dS)Nz
<!DOCTYPE z%s  PUBLIC '%s'%s  '%s'z%s  SYSTEM '%s'z [�]r�)r�r�rgrhror9r
r
r
r Hs
�


zDocumentType.writexml)rrr)r|r}r~r	�DOCUMENT_TYPE_NODErr�r�rgrhror�rpr[r r
r
r
r
rlsrlc@sfeZdZdZejZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)rtNcCs$||_||_t�|_|�||�dSr&)r�rurxr(ri)rr�rgrhrxr
r
r
r�_szEntity.__init__cCs|jSr&�rvrr
r
r
�_get_actualEncodingeszEntity._get_actualEncodingcCs|jSr&�rrr
r
r
�
_get_encodinghszEntity._get_encodingcCs|jSr&�r`rr
r
r
�_get_versionkszEntity._get_versioncCstj�d��dS)Nz(cannot append children to an entity node�r7r8r9)rrFr
r
r
r=ns�zEntity.appendChildcCstj�d��dS)Nz+cannot insert children below an entity noder�r.r
r
r
r5rs�zEntity.insertBeforecCstj�d��dS)Nz*cannot remove children from an entity noder�rOr
r
r
r<vs�zEntity.removeChildcCstj�d��dS)Nz)cannot replace children of an entity noder�r/r
r
r
rMzs�zEntity.replaceChild)r|r}r~r�r	ZENTITY_NODErr�rvrr`r�r~r�r�r=r5r<rMr
r
r
r
rtVsrtc@seZdZejZdZdd�ZdS)rsNcCs||_|�||�dSr&)r�ri)rr�rgrhr
r
r
r��szNotation.__init__)r|r}r~r	r�rr�r�r
r
r
r
rs~srsc@s<eZdZgd�Zdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�DOMImplementation))�core�1.0)r��2.0)r�N)r7r�)r7r�)r7N)�ls-loadz3.0)r�NcCs|dkrd}|��|f|jvSr)�lower�	_featuresr^r
r
r
r]�szDOMImplementation.hasFeaturec	Cs�|r|jdurtj�d��|��}|duo8|duo8|du}|sP|rPtj�d��|r�t|�\}}|dkr||dkr|tj�d��|r�|s�tj�d��|�||�}|r�|�	|�|�	|�|r�||_|_
||_||_|S)Nz(doctype object owned by another DOM treezElement with no namer7z$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces)
r;r7r8�WrongDocumentErr�_create_documentZInvalidCharacterErrrr��createElementNSr=rY�doctyper\)	rrrr�r�Zadd_root_elementr�rr*r
r
r
�createDocument�s>���
��

z DOMImplementation.createDocumentcCst|�}||_||_|Sr&)rlrgrh)rrrgrhr�r
r
r
�createDocumentType�sz$DOMImplementation.createDocumentTypecCs|�|d�r|SdSdSr&)r]rfr
r
r
rg�szDOMImplementation.getInterfacecCst�Sr&)�Documentrr
r
r
r��sz"DOMImplementation._create_documentN)	r|r}r~r�r]r�r�rgr�r
r
r
r
r��s
-r�c@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�ElementInforcCs
||_dSr&rr�r
r
r
r��szElementInfo.__init__cCstSr&�r��rZanamer
r
r
r��szElementInfo.getAttributeTypecCstSr&r�r�r
r
r
r��szElementInfo.getAttributeTypeNScCsdSrr
rr
r
r
rX�szElementInfo.isElementContentcCsdSrr
rr
r
r
�isEmpty�szElementInfo.isEmptycCsdSrr
r�r
r
r
r��szElementInfo.isIdcCsdSrr
r�r
r
r
r��szElementInfo.isIdNScCs|jSr&rrr
r
r
r��szElementInfo.__getstate__cCs
||_dSr&rr�r
r
r
r��szElementInfo.__setstate__N)
r|r}r~r�r�r�r�rXr�r�r�r�r�r
r
r
r
r��s	r�cCs>|jtjkr|j��d|_nt|�r:|jj��d|j_dSr&)rr	r�	_id_cache�clear�_id_search_stackr�rYr�r
r
r
rBs
rBc@sreZdZdZejejejejfZ	e
�ZejZ
dZdZdZdZdZZdZdZdZdZdZdZdZdZdd�Zdd	�Zd
d�Zdd
�Zdd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&dd�Z'dd�Z(d d!�Z)d"d#�Z*d$d%�Z+d&d'�Z,d(d)�Z-d*d+�Z.d,d-�Z/d.d/�Z0d0d1�Z1d2d3�Z2d4d5�Z3d6d7�Z4d8d9�Z5d:d;�Z6d<d=�Z7d>d?�Z8d@dA�Z9dBdC�Z:dIdEdF�Z;dGdH�Z<dS)Jr�)�
_elem_infor�r�r(r�z	#documentNFrcCs$d|_t�|_i|_i|_d|_dSr&)r�rxr(r�r�r�rr
r
r
r�#s
zDocument.__init__cCs&|jr|j|jf}n|j}|j�|�Sr&)rr�r�r�r�)rr*rlr
r
r
r�,szDocument._get_elem_infocCs|jSr&r}rr
r
r
r~3szDocument._get_actualEncodingcCs|jSr&)r�rr
r
r
�_get_doctype6szDocument._get_doctypecCs|jSr&)�documentURIrr
r
r
�_get_documentURI9szDocument._get_documentURIcCs|jSr&rrr
r
r
r�<szDocument._get_encodingcCs|jSr&)�errorHandlerrr
r
r
�_get_errorHandler?szDocument._get_errorHandlercCs|jSr&)rrr
r
r
�_get_standaloneBszDocument._get_standalonecCs|jSr&)�strictErrorCheckingrr
r
r
�_get_strictErrorCheckingEsz!Document._get_strictErrorCheckingcCs|jSr&r�rr
r
r
r�HszDocument._get_versioncCsj|j|jvr(tj�dt|�t|�f��|jdur>|j�|�|jtj	kr^|�
�r^tj�d��t�||�S)Nr1z two document elements disallowed)rr6r7r8r9r:r;r<r	rT�_get_documentElementr=r�r
r
r
r=Ks�
��zDocument.appendChildcCsTz|j�|�Wnty,tj���Yn0d|_|_d|_|j	|urPd|_	|Sr&)
r(rNr?r7r8r@rDrEr;�documentElementrOr
r
r
r<[s
zDocument.removeChildcCs$|jD]}|jtjkr|SqdSr&)r(rr	rTr�r
r
r
r�gs
zDocument._get_documentElementcCs(|jdur|j��d|_t�|�dSr&)r�rRr	rr
r
r
rRls

zDocument.unlinkcCs�|sdS|j�ddd�}|j|_|j|_|j|_|jD]B}t|||�}|j�|�|jt	j
kr`n|jt	jkrr||_||_
q6|�tjjj||�|Sr&)r\r�rrr`r(rXrSrr	rr|r�r;rwr7r8rqrr)rrZrwr�Z
childcloner
r
r
r[rs$
�zDocument.cloneNodecCst�}||_|Sr&)r�rY)rrpr
r
r
�createDocumentFragment�szDocument.createDocumentFragmentcCst|�}||_|Sr&)rrY)rr�ryr
r
r
�
createElement�szDocument.createElementcCs(t|t�std��t�}||_||_|S�Nznode contents must be a string)r�r�r�r�rQrY)rrQ�tr
r
r
�createTextNode�s
zDocument.createTextNodecCs(t|t�std��t�}||_||_|Sr�)r�r�r�r\rQrY�rrQrHr
r
r
�createCDATASection�s
zDocument.createCDATASectioncCst|�}||_|Sr&)r[rYr�r
r
r
�
createComment�szDocument.createCommentcCst||�}||_|Sr&)r0rY)rr2rQ�pr
r
r
�createProcessingInstruction�s
z$Document.createProcessingInstructioncCst|�}||_d|_|Sr)r�rYr�)rr��ar
r
r
�createAttribute�szDocument.createAttributecCs"t|�\}}t|||�}||_|Sr&)rrrY)rrrr�r�ryr
r
r
r��szDocument.createElementNScCs*t|�\}}t||||�}||_d|_|Sr)rr�rYr�)rrrr�r�r�r
r
r
�createAttributeNS�s
zDocument.createAttributeNScCst||||�}||_|Sr&)rtrY)rr�rgrhruryr
r
r
�_create_entity�szDocument._create_entitycCst|||�}||_|Sr&)rsrY)rr�rgrhr�r
r
r
�_create_notation�szDocument._create_notationcCs�||jvr|j|S|js$|js$dS|j}|durB|jg}||_n|sJdSd}|�r�|��}|�dd�|jD��|�|�}|�rB|j	�
�D]�}|jr�|�|j|j
�r�||j|j<|j|kr�|}n|js��q�q�|�|j��r
||j|j<|j|kr�|}n|j�s>�q�q�|jr�||j|j<|j|k�r.|}q�|jdkr��q�q�n>|j�r�|j	�
�D]*}|j�rT||j|j<|j|k�rT|}�qT|durN�q�qN|S)NcSsg|]}|jtvr|�qSr
)rrA)�.0rWr
r
r
�
<listcomp>�s
�z+Document.getElementById.<locals>.<listcomp>r2)r�r�r�r�r��pop�extendr(r�r�r�rr�r�r�r�r�r�r�)rr��stack�resultrIr�r	r
r
r
�getElementById�sZ






zDocument.getElementByIdcCst||t��Sr&rr�r
r
r
rszDocument.getElementsByTagNamecCst|||t��Sr&rr�r
r
r
r s
�zDocument.getElementsByTagNameNScCs|j�||�Sr&)r\r]r^r
r
r
raszDocument.isSupportedcCs>|jtjkrtj�d��n|jtjkr2tj�d��t|||�S)Nzcannot import document nodesz!cannot import document type nodes)rr	rr7r8�NotSupportedErrr|rX)rrIrZr
r
r
�
importNodes
zDocument.importNoderc	Csxg}|r|�d|�d��|dur<|�d|r0dnd�d��|�dd�|��d|���|jD]}|�||||�q^dS)	Nz
encoding="r�zstandalone="ZyesZnoz<?xml version="1.0" � z?>)rSr�rSr(r )	rr%r#r"r$rrZdeclarationsrIr
r
r
r s
zDocument.writexmlcCsJ|j|ur tj�d||jf��|jtjtjfvr>tj�d��|t	kr�d|vr�|�
dd�\}}|dkr�|tjjkr�tj�d��q�|dkr�|tjjkr�|jtjkr�tj�d��d}|}nd}d}|jtjkr�|j
}|dur�|j}|�|�nd}||_||_||_||_|jtjk�r||_n*||_|du�rF|�|�|�rF|�|�|S)Nz?cannot rename nodes from other documents;
expected %s,
found %sz8renameNode() only applies to element and attribute nodesr�r2r�zillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rYr7r8r�rr	rTr�r�rr�rr�r�r�rr�r�rr�r�r�r
r$)rr�rr�r�r�r*Zis_idr
r
r
�
renameNode&sb
���
��
�
��


zDocument.renameNode)rrrNN)=r|r}r~r�r	rTr�r�r|r6r�r\rrr�r�r�r;rErDrvrrr`r�r�r�r�r�r�r~r�r�r�r�r�r�r�r=r<r�rRr[r�r�r�r�r�r�r�r�r�r�r�r�rr rar�r r�r
r
r
r
r�sl�	
:�
r�r�z#Top-level element of this document.c
Cs�|j�|�rtjjj}n
tjjj}|jtj	kr�|�
|j|j�}|j
��D]0}|�|j|j|j�|�|j|j�}|j|_qH|r�|jD]}t|||�}|�|�q��n|jtjkr�|��}|r�|jD]}t|||�}|�|�qn�|jtjkr�|�|j�}�n�|jtjk�r|�|j�}�n�|jtjk�r>|�|j |j�}�nj|jtj!k�r\|�"|j�}�nL|jtj#k�r�|�$|j|j�}d|_|j|_�n|jtj%k�r�tjjj}|j&�'|j(|j)|j*�}||_|�r�g|j+_,g|j-_,|j-j,D]F}	t.|	j|	j)|	j*�}
||
_|j-j,�/|
�t0|	d��r�|	�1||	|
��q�|j+j,D]b}t2|j|j)|j*|j3�}|j4|_4|j5|_5|j6|_6||_|j+j,�/|�t0|d��r.|�1|||��q.ntj�7dt8|���t0|d��r�|�1|||�|S)NTrwzCannot clone node %s)9rYrer7r8rqrrZ
NODE_IMPORTEDrr	rTr�rr�r�r�rr�rr�r�r(rXr=r3r�rPr�rQr�r�r�r�r2r�r�r�r�r|r\r�r�rgrhrmr`rnrsrSrrrwrtrurvrr`r�r:)
rIrZZnewOwnerDocumentrurwr	r�rWrHr�rxryrzr
r
r
rX_s�
�


��
��rXcCs,|�dd�}t|�dkr|Sd|dfSdS)Nr�r2�r)r�r�)r�fieldsr
r
r
r�srcCs0||i|��}|��\}}|�|�|��|Sr&)ZgetEventZ
expandNoder�)�func�args�kwargsZeventsZtoktypeZrootNoder
r
r
�_do_pulldom_parse�s

r�cCsH|dur"|s"ddlm}|�|�Sddlm}t|j|f||d��SdS)Nr��expatbuilder��pulldom)�parser�bufsize)�xml.domr��parser�r�)�filer�r�r�r�r
r
r
r��s

�r�cCsB|durddlm}|�|�Sddlm}t|j|fd|i�SdS)Nrr�r�r�)r�r��parseStringr�r�)�stringr�r�r�r
r
r
r��s

�r�cCs@|r:t|t�rt�|�}|D]\}}tj�||�sdSqtjSr&)r�r�rZ_parse_feature_stringr�r\r])Zfeatures�f�vr
r
r
�getDOMImplementation�s

r�)NN)N)N)6rr�r7rrrrZxml.dom.minicompatZxml.dom.xmlbuilderrrr8r	rTr�rAZdefpropertyrKr�r�r�r�r�r��objectr�Z
AttributeListr�r�rrr+r0r:r�rWr(r[r\r^rerlrtrsr�r�rBr�rXrr�r�r�r�r
r
r
r
�<module>s��w
	y$�
��)GU��	>�<(	O*U�R




?>