Your IP : 52.15.209.178


Current Path : /opt/alt/python35/lib64/python3.5/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/xml/dom/__pycache__/minidom.cpython-35.opt-2.pyc



���]�@s+ddlZddlZddlmZmZmZmZddlTddlm	Z	m
Z
ejjj
ejjjfZGdd�dejj�Zeeddd	�eed
dd�eeddd
�dd�Zdd�Zdd�Zdd�Zdd�ZGdd�de�ZGdd�de�Zeeddd�eeddd�eeddd �Gd!d"�d"e�Zeed#dd$�eZGd%d&�d&e�Zedd�ZGd'd(�d(e�Zeed)dd*�eeddd+�d,d-�ZGd.d/�d/�ZGd0d1�d1ee�Z Gd2d3�d3ee�Z!ee!d#dd4�Gd5d6�d6e!�Z"ee"d7dd8�ee"d9dd:�d;d<�Z#d=d>�Z$Gd?d@�d@e!�Z%GdAdB�dBe"�Z&GdCdD�dDe�Z'ee'd#ddE�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/dVddW�dXdY�Z0dZd[�Z1d\d]�Z2ddd^d_�Z3dd`da�Z4ddbdc�Z5dS)d�N)�EMPTY_NAMESPACE�EMPTY_PREFIX�XMLNS_NAMESPACE�domreg)�*)�DOMImplementationLS�
DocumentLSc@sTeZdZdZdZdZdZdZeZ	dd�Z
ddd�Zddddd	�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)2�NodeNcCsdS)NT�)�selfr
r
�,/opt/alt/python35/lib64/python3.5/minidom.py�__bool__+sz
Node.__bool__cCs|jdd|�S)N�)�toprettyxml)r�encodingr
r
r�toxml.sz
Node.toxml�	�
cCs�|dkrtj�}n'tjtj�d|dddd�}|jtjkrp|j|d|||�n|j|d||�|dkr�|j�S|j	�j�SdS)Nr�errors�xmlcharrefreplace�newlinerr)
�io�StringIO�
TextIOWrapper�BytesIO�nodeTyper	�
DOCUMENT_NODE�writexml�getvalue�detach)r�indent�newlr�writerr
r
rr1s	
zNode.toprettyxmlcCs
t|j�S)N)�bool�
childNodes)rr
r
r�
hasChildNodesCszNode.hasChildNodescCs|jS)N)r$)rr
r
r�_get_childNodesFszNode._get_childNodescCs|jr|jdSdS)Nr)r$)rr
r
r�_get_firstChildIs	zNode._get_firstChildcCs|jr|jdSdS)N����)r$)rr
r
r�_get_lastChildMs	zNode._get_lastChildcCso|j|jkr@x't|j�D]}|j||�q"W|S|j|jkrztjjdt	|�t	|�f��|j
dk	r�|j
j|�|dkr�|j|�n�y|jj
|�}Wn!tk
r�tjj��YnX|jtkrt|�|jj||�||_||_|rY|j|d}||_||_n	d|_||_
|S)Nz%s cannot be child of %sr()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�cr6�noder
r
rr-Qs6	

					zNode.insertBeforecCs�|j|jkr=x$t|j�D]}|j|�q"W|S|j|jkrztjjdt	|�t	|�f��n|jt
kr�t|�|jdk	r�|jj
|�t||�d|_|S)Nz%s cannot be child of %s)rr+r,r$r5r.r/r0r1r2r9r:r3r4�
_append_childr<)rrAr@r
r
rr5qs	"

	zNode.appendChildcCsz|j|jkr8|j}|j|�|j||�S|j|jkrrtjjdt	|�t	|�f��||kr�dS|j
dk	r�|j
j|�y|jj|�}Wn!t
k
r�tjj��YnX||j|<||_
d|_
|jtks|jtkr"t|�|j|_|j|_d|_d|_|jra||j_|jrv||j_|S)Nz%s cannot be child of %s)rr+r<r4r-r.r/r0r1r2r3r$r6r7r8r9r:r=)rr>�oldChildr?r6r
r
r�replaceChild�s<	
	

		
				zNode.replaceChildcCs�y|jj|�Wn!tk
r7tjj��YnX|jdk	rV|j|j_|jdk	rt|j|j_d|_|_|jt	kr�t
|�d|_|S)N)r$�remover7r/r0r8r<r=rr9r:r3)rrCr
r
rr4�s

	zNode.removeChildcCs'g}x|jD]�}|jtjkr�|jsl|rG|j|d_|jr_|j|j_|j�q|r�|dj|jkr�|d}|j|j|_|j|_|jr�||j_|j�q|j|�q|j|�|jtj	kr|j
�qW||jdd�<dS)Nr(r)r)r))r$rr	�	TEXT_NODE�datar<r=�unlink�append�ELEMENT_NODE�	normalize)r�L�childrAr
r
rrK�s*		

	

zNode.normalizecCst|||jp|�S)N)�_clone_node�
ownerDocument)r�deepr
r
r�	cloneNode�szNode.cloneNodecCs|jjj||�S)N)rO�implementation�
hasFeature)r�feature�versionr
r
r�isSupported�szNode.isSupportedcCsdS)Nr
)rr
r
r�_get_localName�szNode._get_localNamecCs
||kS)Nr
)r�otherr
r
r�
isSameNode�szNode.isSameNodecCs|j|d�r|SdSdS)N)rV)rrTr
r
r�getInterface�szNode.getInterfacecCs6y|j|dSWnttfk
r1dSYnXdS)Nr)�
_user_data�AttributeError�KeyError)r�keyr
r
r�getUserData�szNode.getUserDatacCs�d}y
|j}Wn!tk
r6i}||_YnX||krQ||d}|dkryd}|dk	r�||=n||f||<|S)Nr)r[r\)rr^rG�handler�old�dr
r
r�setUserData�s


zNode.setUserDatacCsdt|d�r`xNt|jj��D]7\}\}}|dk	r%|j|||||�q%WdS)Nr[)�hasattr�listr[�items�handle)r�	operation�src�dstr^rGr`r
r
r�_call_user_data_handler�s(zNode._call_user_data_handlercCsYd|_|_|jrCx|jD]}|j�q#Wt�|_d|_d|_dS)N)r3rOr$rH�NodeListr=r<)rrMr
r
rrHs		zNode.unlinkcCs|S)Nr
)rr
r
r�	__enter__szNode.__enter__cCs|j�dS)N)rH)r�etZev�tbr
r
r�__exit__sz
Node.__exit__)!�__name__�
__module__�__qualname__�namespaceURIr3rOr<r=r�prefixr
rrr%r&r'r*r-r5rDr4rKrQrVrWrYrZr_rcrkrHrmrpr
r
r
rr	"s:  
r	�
firstChild�doczFirst child node, or None.�	lastChildzLast child node, or None.�	localNamez"Namespace-local name of this node.cCsE|j}|r+|d}||_||_|j|�||_dS)Nr(r))r$r=r<rIr3)rrAr$Zlastr
r
rrBs	
		
rBcCs6x/|dk	r1|jtjkr%dS|j}qWdS)NTF)rr	rr3)rAr
r
r�_in_document&s

rzcCsM|rI|jdd�jdd�jdd�jdd�}|j|�dS)	N�&z&amp;�<z&lt;�"z&quot;�>z&gt;)�replace�write)r"rGr
r
r�_write_data.sr�cCsbx[|jD]P}|jtjkrJ|dks=|j|krJ|j|�t|||�q
W|S)Nr)r$rr	rJ�tagNamerI�_get_elements_by_tagName_helper)�parent�name�rcrAr
r
rr�5s
r�cCs�xy|jD]n}|jtjkr
|dks=|j|kre|dksX|j|kre|j|�t||||�q
W|S)Nr)r$rr	rJryrtrI�"_get_elements_by_tagName_ns_helper)r�ZnsURIryr�rAr
r
rr�=s
r�c@smeZdZejZdZdZdZdZ	ej
ejejej
ejejejfZdd�ZdS)�DocumentFragmentz#document-fragmentNcCst�|_dS)N)rlr$)rr
r
r�__init__TszDocumentFragment.__init__)rqrrrsr	r+r�nodeName�	nodeValue�
attributesr3rJrF�CDATA_SECTION_NODE�ENTITY_REFERENCE_NODE�PROCESSING_INSTRUCTION_NODE�COMMENT_NODE�
NOTATION_NODEr.r�r
r
r
rr�Fs	r�c@seZdZd#ZejZd	Zd
Zd
Z	ej
ejfZe
d	d	dd�Zd
d�Zdd�Zdd�Zdd�Zeee�ZZdd�Zdd�Zeee�ZZdd�Zdd�Zeee�Zdd�Zdd �Zd!d"�Zd	S)$�Attr�_name�_valuert�_prefixr$�
_localNamerO�ownerElementNFcCsGd|_||_||_||_t�|_|jjt��dS)N)r�r�rtr�rlr$rI�Text)r�qNamertryrur
r
rr�bs				z
Attr.__init__cCs;y|jSWn)tk
r6|jjdd�dSYnXdS)N�:r(r))r�r\r��split)rr
r
rrWos
zAttr._get_localNamecCs|jS)N)�	specified)rr
r
r�_get_specifieduszAttr._get_specifiedcCs|jS)N)r�)rr
r
r�	_get_namexszAttr._get_namecCs)||_|jdk	r%t|j�dS)N)r�r�r:)r�valuer
r
r�	_set_name{s	zAttr._set_namecCs|jS)N)r�)rr
r
r�
_get_value�szAttr._get_valuecCsI||_||jd_|jdk	r5t|j�||jd_dS)Nr)r�r$rGr�r:)rr�r
r
r�
_set_value�s
	
zAttr._set_valuecCs|jS)N)r�)rr
r
r�_get_prefix�szAttr._get_prefixcCs�|j}|dkr9|r9|tkr9tjjd��||_|dkrZ|j}nd||jf}|jr�t|j�||_	dS)N�xmlnsz5illegal use of 'xmlns' prefix for the wrong namespacez%s:%s)
rtrr/r0�NamespaceErrr�ryr�r:r�)rruZnsuriZnewNamer
r
r�_set_prefix�s					
zAttr._set_prefixcCs�|j}|dk	rk|j|j=|j|j|jf=|jrkd|_|jd8_|jj	d8_	x|j
D]}|j�quW|j
dd�=dS)NFr()r��_attrsr��_attrsNSrtry�_is_id�_magic_id_nodesrO�_magic_id_countr$rH)r�elemrMr
r
rrH�s	
		zAttr.unlinkcCs�|jr
dS|j}|j}|dks7|dkr;dS|j|�}|dkrZdS|jry|j|j|j�S|j|j�SdS)NTF)	r�rOr��_get_elem_infort�isIdNSry�isIdr�)rrwr��infor
r
r�	_get_isId�s				zAttr._get_isIdcCs�|j}|j}|dks*|dkr.tS|j|�}|dkrMtS|jrl|j|j|j�S|j|j�SdS)N)	rOr��_no_typer�rt�getAttributeTypeNSry�getAttributeTyper�)rrwr�r�r
r
r�_get_schemaType�s			zAttr._get_schemaType)r�r�rtr�r$r�rOr�) rqrrrs�	__slots__r	�ATTRIBUTE_NODErr�r�r�rFr�r.rr�rWr�r�r��propertyr�r�r�r�r�r�r�r�rurHr�r�r
r
r
rr�Xs.	r�r�z True if this attribute is an ID.z'Namespace-local name of this attribute.�
schemaTypezSchema type for this attribute.c@sceZdZd;Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zddd�Z
eZdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)<�NamedNodeMapr�r��
_ownerElementcCs||_||_||_dS)N)r�r�r�)r�attrsZattrsNSr�r
r
rr��s		zNamedNodeMap.__init__cCs
t|j�S)N)�lenr�)rr
r
r�_get_length�szNamedNodeMap._get_lengthcCs<y|t|jj��|SWntk
r7dSYnXdS)N)rer��keys�
IndexError)rr6r
r
r�item�s
zNamedNodeMap.itemcCs=g}x0|jj�D]}|j|j|jf�qW|S)N)r��valuesrIr�r�)rrLrAr
r
rrf�szNamedNodeMap.itemscCsFg}x9|jj�D](}|j|j|jf|jf�qW|S)N)r�r�rIrtryr�)rrLrAr
r
r�itemsNS�s&zNamedNodeMap.itemsNScCs-t|t�r||jkS||jkSdS)N)�
isinstance�strr�r�)rr^r
r
r�__contains__�s
zNamedNodeMap.__contains__cCs
|jj�S)N)r�r�)rr
r
rr�szNamedNodeMap.keyscCs
|jj�S)N)r�r�)rr
r
r�keysNSszNamedNodeMap.keysNScCs
|jj�S)N)r�r�)rr
r
rr�szNamedNodeMap.valuesNcCs|jj||�S)N)r��get)rr�r�r
r
rr�
szNamedNodeMap.getcCsO|jt|dd�krdSt|�t|�kt|�t|�kSdS)Nr�r)r��getattr�id)rrXr
r
r�_cmpszNamedNodeMap._cmpcCs|j|�dkS)Nr)r�)rrXr
r
r�__eq__szNamedNodeMap.__eq__cCs|j|�dkS)Nr)r�)rrXr
r
r�__ge__szNamedNodeMap.__ge__cCs|j|�dkS)Nr)r�)rrXr
r
r�__gt__szNamedNodeMap.__gt__cCs|j|�dkS)Nr)r�)rrXr
r
r�__le__szNamedNodeMap.__le__cCs|j|�dkS)Nr)r�)rrXr
r
r�__lt__!szNamedNodeMap.__lt__cCs)t|t�r|j|S|j|SdS)N)r�r,r�r�)r�attname_or_tupler
r
r�__getitem__$szNamedNodeMap.__getitem__cCs�t|t�riy|j|}Wn:tk
r\t|�}|jj|_|j|�YnX||_n.t|t�s�t	d��|}|j|�dS)Nz%value must be a string or Attr object)
r�r�r�r]r�r�rO�setNamedItemr��	TypeError)r�attnamer�rAr
r
r�__setitem__+s
zNamedNodeMap.__setitem__cCs,y|j|SWntk
r'dSYnXdS)N)r�r])rr�r
r
r�getNamedItem:s
zNamedNodeMap.getNamedItemcCs2y|j||fSWntk
r-dSYnXdS)N)r�r])rrtryr
r
r�getNamedItemNS@s
zNamedNodeMap.getNamedItemNScCsz|j|�}|dk	rgt|j�|j|j=|j|j|jf=t|d�rcd|_	|St
jj��dS)Nr�)
r�r:r�r�r�r�rtryrdr�r/r0r8)rr��nr
r
r�removeNamedItemFs

	zNamedNodeMap.removeNamedItemcCs}|j||�}|dk	rjt|j�|j|j|jf=|j|j=t|d�rfd|_	|St
jj��dS)Nr�)
r�r:r�r�rtryr�r�rdr�r/r0r8)rrtryr�r
r
r�removeNamedItemNSRs

	zNamedNodeMap.removeNamedItemNScCs�t|t�s7tjjdt|�t|�f��|jj|j�}|r\|j	�||j|j<||j
|j|jf<|j
|_t|j�|S)Nz%s cannot be child of %s)r�r�r/r0r1r2r�r�r�rHr�rtryr�r�r:)rrArar
r
rr�^s	

zNamedNodeMap.setNamedItemcCs
|j|�S)N)r�)rrAr
r
r�setNamedItemNSkszNamedNodeMap.setNamedItemNScCs%||}t|j�|j�dS)N)r:r�rH)rr�rAr
r
r�__delitem__ns

zNamedNodeMap.__delitem__cCs|j|j|jfS)N)r�r�r�)rr
r
r�__getstate__sszNamedNodeMap.__getstate__cCs|\|_|_|_dS)N)r�r�r�)r�stater
r
r�__setstate__vszNamedNodeMap.__setstate__)r�r�r�) rqrrrsr�r�r�r�rfr�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��lengthz$Number of nodes in the NamedNodeMap.c@sFeZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)
�TypeInfo�	namespacer�cCs||_||_dS)N)r�r�)rr�r�r
r
rr��s	zTypeInfo.__init__cCsA|jr&d|jj|j|jfSd|jj|jfSdS)Nz<%s %r (from %r)>z<%s %r>)r��	__class__rqr�)rr
r
r�__repr__�s	zTypeInfo.__repr__cCs|jS)N)r�)rr
r
rr��szTypeInfo._get_namecCs|jS)N)r�)rr
r
r�_get_namespace�szTypeInfo._get_namespaceN)r�r�)rqrrrsr�r�r�r�r�r
r
r
rr�s
r�c@s�eZdZdDZejZd
ZeZ	dZ
ejejejej
ejejfZed
d
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZeZd'd(�Zd)d*�Z d+d,�Z!e!Z"d-d.�Z#d/d0�Z$d1d2�Z%d3d4�Z&d5d6�Z'd7d7d7d8d9�Z(d:d;�Z)d<d=�Z*d>d?�Z+d@dA�Z,dBdC�Z-d
S)E�ElementrOr3r�r�rurtr�r$r�r�r<r=NrcCs]d|_||_|_||_||_t�|_d|_|_d|_	d|_
dS)N)r3r�r�rurtrlr$r<r=r�r�)rr�rtruryr
r
rr��s			
	zElement.__init__cCs%|jdkr!i|_i|_dS)N)r�r�)rr
r
r�_ensure_attributes�s	zElement._ensure_attributescCs;y|jSWn)tk
r6|jjdd�dSYnXdS)Nr�r(r))r�r\r�r�)rr
r
rrW�s
zElement._get_localNamecCs|jS)N)r�)rr
r
r�_get_tagName�szElement._get_tagNamecCs\|jdk	r9x't|jj��D]}|j�q%Wd|_d|_tj|�dS)N)r�rer�rHr�r	)r�attrr
r
rrH�s		zElement.unlinkcCsB|jdkrdSy|j|jSWntk
r=dSYnXdS)Nr)r�r�r])rr�r
r
r�getAttribute�s
zElement.getAttributecCsH|jdkrdSy|j||fjSWntk
rCdSYnXdS)Nr)r�r�r])rrtryr
r
r�getAttributeNS�s
zElement.getAttributeNScCs{|j|�}|dkrLt|�}||_|j|_|j|�n+||jkrw||_|jrwt|�dS)N)�getAttributeNoder�r�rO�setAttributeNoder�r:)rr�r�r�r
r
r�setAttribute�s			zElement.setAttributecCs�t|�\}}|j||�}|dkrjt||||�}||_|j|_|j|�nL||jkr�||_|jr�t|�|j|kr�||_||_	dS)N)
�_nssplit�getAttributeNodeNSr�r�rOr�r�r:rur�)rrt�
qualifiedNamer�ru�	localnamer�r
r
r�setAttributeNS�s			
	zElement.setAttributeNScCs#|jdkrdS|jj|�S)N)r�r�)rZattrnamer
r
rr��szElement.getAttributeNodecCs)|jdkrdS|jj||f�S)N)r�r�)rrtryr
r
rr�szElement.getAttributeNodeNScCs�|jd|fkr'tjjd��|j�|jj|jd�}|dk	rb|j|�|j	j|j
|jfd�}|dk	r�||k	r�|j|�t||�||k	r�|S||k	r�|SdS)Nzattribute node already owned)
r�r/r0ZInuseAttributeErrr�r�r�r��removeAttributeNoder�rtry�_set_attribute_node)rr�Zold1Zold2r
r
rr�s

!

zElement.setAttributeNodecCsd|jdkrtjj��y|j|}Wn!tk
rRtjj��YnX|j|�dS)N)r�r/r0r8r�r]r�)rr�r�r
r
r�removeAttributes
zElement.removeAttributecCsj|jdkrtjj��y|j||f}Wn!tk
rXtjj��YnX|j|�dS)N)r�r/r0r8r]r�)rrtryr�r
r
r�removeAttributeNS%s
zElement.removeAttributeNScCsu|dkrtjj��y|j|jWn!tk
rPtjj��YnXt|�|j�|j|_dS)N)	r/r0r8r�r�r]r:rHrO)rrAr
r
rr�.s


zElement.removeAttributeNodecCs |jdkrdS||jkS)NF)r�)rr�r
r
r�hasAttribute=szElement.hasAttributecCs&|jdkrdS||f|jkS)NF)r�)rrtryr
r
r�hasAttributeNSBszElement.hasAttributeNScCst||t��S)N)r�rl)rr�r
r
r�getElementsByTagNameGszElement.getElementsByTagNamecCst|||t��S)N)r�rl)rrtryr
r
r�getElementsByTagNameNSJszElement.getElementsByTagNameNScCsd|jt|�fS)Nz<DOM Element: %s at %#x>)r�r�)rr
r
rr�NszElement.__repr__rc	CsW|j|d|j�|j�}t|j��}x@|D]8}|jd|�t|||j�|jd�q=W|jrB|jd�t|j�dkr�|jdj	t
jkr�|jdj|ddd�nH|j|�x+|jD] }|j|||||�q�W|j|�|jd|j|f�n|jd	|�dS)
Nr|z %s="r}r~r(rrz</%s>%sz/>%s)
r�r��_get_attributes�sortedr�r�r�r$r�rr	rFr)	rr"r �	addindentr!r�Za_namesZa_namerAr
r
rrQs$
	
 

zElement.writexmlcCs |j�t|j|j|�S)N)r�r�r�r�)rr
r
rr�ls
zElement._get_attributescCs|jr
dSdSdS)NTF)r�)rr
r
r�
hasAttributesps	zElement.hasAttributescCs |j|�}|j|�dS)N)r��setIdAttributeNode)rr��idAttrr
r
r�setIdAttributexszElement.setIdAttributecCs#|j||�}|j|�dS)N)r�r)rrtryrr
r
r�setIdAttributeNS|szElement.setIdAttributeNScCs�|dks|j|j�r.tjj��t|�dk	rOtjj��|js�d|_|jd7_|j	j
d7_
t|�dS)NTr()rYr�r/r0r8�_get_containing_entref�NoModificationAllowedErrr�r�rOr�r:)rrr
r
rr�s		zElement.setIdAttributeNode)rOr3r�r�rurtr�r$r�r�r<r=).rqrrrsr�r	rJrr�r�r�r�r�r�rFr�r�r.rr�r�rWr�rHr�r�r�r�r�r�r�ZsetAttributeNodeNSr�r�r�ZremoveAttributeNodeNSr�r�r�r�r�rr�rrrrr
r
r
rr��sT			
r�r�z*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.cCsJt|�|j�||j|j<||j|j|jf<||_dS)N)r:r�r�r�r�rtryr�)�elementr�r
r
rr��s


r�c@s�eZdZfZdZe�ZdZdZdd�Z	dd�Z
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�ZdS)�	ChildlessNcCsdS)Nr
)rr
r
rr'�szChildless._get_firstChildcCsdS)Nr
)rr
r
rr*�szChildless._get_lastChildcCstjj|jd��dS)Nz nodes cannot have children)r/r0r1r�)rrAr
r
rr5�s	zChildless.appendChildcCsdS)NFr
)rr
r
rr%�szChildless.hasChildNodescCstjj|jd��dS)Nz nodes do not have children)r/r0r1r�)rr>r?r
r
rr-�s	zChildless.insertBeforecCstjj|jd��dS)Nz nodes do not have children)r/r0r8r�)rrCr
r
rr4�s	zChildless.removeChildcCsdS)Nr
)rr
r
rrK�szChildless.normalizecCstjj|jd��dS)Nz nodes do not have children)r/r0r1r�)rr>rCr
r
rrD�s	zChildless.replaceChild)rqrrrsr�r�Z
EmptyNodeListr$rvrxr'r*r5r%r-r4rKrDr
r
r
rr	�s	r	c@s�eZdZejZdZdd�Zdd�Zdd�Z	e
ee	�Zd	d
�Zdd�Z
e
ee
�Zd
d
d
dd�ZdS)�ProcessingInstruction�targetrGcCs||_||_dS)N)rrG)rrrGr
r
rr��s	zProcessingInstruction.__init__cCs|jS)N)rG)rr
r
r�_get_nodeValue�sz$ProcessingInstruction._get_nodeValuecCs
||_dS)N)rG)rr�r
r
r�_set_nodeValue�sz$ProcessingInstruction._set_nodeValuecCs|jS)N)r)rr
r
r�
_get_nodeName�sz#ProcessingInstruction._get_nodeNamecCs
||_dS)N)r)rr�r
r
r�
_set_nodeName�sz#ProcessingInstruction._set_nodeNamercCs'|jd||j|j|f�dS)Nz
%s<?%s %s?>%s)r�rrG)rr"r rr!r
r
rr�szProcessingInstruction.writexmlN)rrG)rqrrrsr	r�rr�r�rr
r�r�rrr�rr
r
r
rr
�s	r
c@s�eZdZdZdd�Zdd	�ZeZd
d�Zdd
�Ze	ee�Z
Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�
CharacterData�_datarOr3r=r<cCs:d|_|_d|_|_d|_tj|�dS)Nr)rOr3r=r<rr	r�)rr
r
rr��s	zCharacterData.__init__cCs
t|j�S)N)r�rG)rr
r
rr��szCharacterData._get_lengthcCs|jS)N)r)rr
r
r�	_get_data�szCharacterData._get_datacCs
||_dS)N)r)rrGr
r
r�	_set_data�szCharacterData._set_datacCsK|j}t|�dkr$d}nd}d|jj|dd�|fS)N�
z...rz<DOM %s node "%r%s">r)rGr�r�rq)rrGZ	dotdotdotr
r
rr��s		zCharacterData.__repr__cCsx|dkrtjjd��|t|j�krEtjjd��|dkrctjjd��|j|||�S)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0�IndexSizeErrr�rG)r�offset�countr
r
r�
substringData�szCharacterData.substringDatacCs|j||_dS)N)rG)r�argr
r
r�
appendDataszCharacterData.appendDatacCs|dkrtjjd��|t|j�krEtjjd��|r{d|jd|�||j|d�f|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of dataz%s%s%s)r/r0rr�rG)rrrr
r
r�
insertDataszCharacterData.insertDatacCs�|dkrtjjd��|t|j�krEtjjd��|dkrctjjd��|r�|jd|�|j||d�|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negative)r/r0rr�rG)rrrr
r
r�
deleteDataszCharacterData.deleteDatacCs�|dkrtjjd��|t|j�krEtjjd��|dkrctjjd��|r�d|jd|�||j||d�f|_dS)Nrzoffset cannot be negativez#offset cannot be beyond end of datazcount cannot be negativez%s%s%s)r/r0rr�rG)rrrrr
r
r�replaceDataszCharacterData.replaceDataN)rrOr3r=r<)rqrrrsr�r�r�r�rrr�rGr�r�rrrrrr
r
r
rr�s			
rzLength of the string data.c@speZdZfZejZdZdZdd�Z	ddddd�Z
dd	�Zd
d�Zdd
�Z
dS)r�z#textNcCs�|dks!|t|j�kr3tjjd��|j�}|j|d�|_|j|_|j}|jr�||jj	kr�|dkr�|jj
|�n|jj||�|jd|�|_|S)Nrzillegal offset value)r�rGr/r0rr�rOr<r3r$r5r-)rrZnewText�nextr
r
r�	splitText0s!	zText.splitTextrcCs!t|d||j|f�dS)Nz%s%s%s)r�rG)rr"r rr!r
r
rr?sz
Text.writexmlcCs�|jg}|j}xK|dk	rb|jtjtjfkr^|jd|j�|j}qPqW|j}xH|dk	r�|jtjtjfkr�|j|j�|j}qoPqoWdj	|�S)Nrr)
rGr=rr	rFr�r;r<rI�join)rrLr�r
r
r�_get_wholeTextDs		zText._get_wholeTextcCs�|j}|j}xK|dk	r_|jtjtjfkr[|j}|j|�|}qPqW|j}|s||j|�xK|dk	r�|jtjtjfkr�|j}|j|�|}qPqW|r�||_|SdSdS)N)	r3r=rr	rFr�r4r<rG)rZcontentr�r�rr
r
r�replaceWholeTextVs*			
		
	
		zText.replaceWholeTextcCs_|jj�rdSt|�}|dkr/dS|jj|�}|dkrQdS|j�SdS)NF)rG�strip�_get_containing_elementrOr��isElementContent)rr�r�r
r
r�!_get_isWhitespaceInElementContentrsz&Text._get_isWhitespaceInElementContent)rqrrrsr�r	rFrr�r�rrr!r"r&r
r
r
rr�)s	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}x/|dk	r:|jtjkr.|S|j}qWdS)N)r3rr	rJ)rAr@r
r
rr$�s	
r$cCs?|j}x/|dk	r:|jtjkr.|S|j}qWdS)N)r3rr	r�)rAr@r
r
rr�s	
rc@s@eZdZejZdZdd�Zddddd�ZdS)�Commentz#commentcCstj|�||_dS)N)rr�r)rrGr
r
rr��s
zComment.__init__rcCs<d|jkrtd��|jd||j|f�dS)Nz--z%'--' is not allowed in a comment nodez
%s<!--%s-->%s)rGr7r�)rr"r rr!r
r
rr�szComment.writexmlN)	rqrrrsr	r�rr�r�rr
r
r
rr'�s	r'c@s:eZdZfZejZdZddddd�ZdS)�CDATASectionz#cdata-sectionrcCs<|jjd�dkr$td��|jd|j�dS)Nz]]>rz$']]>' not allowed in a CDATA sectionz<![CDATA[%s]]>)rG�findr7r�)rr"r rr!r
r
rr�szCDATASection.writexmlN)	rqrrrsr�r	r�rr�rr
r
r
rr(�s	r(c@s�eZdZdZfdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ReadOnlySequentialNamedNodeMap�_seqcCs
||_dS)N)r+)r�seqr
r
rr��sz'ReadOnlySequentialNamedNodeMap.__init__cCs
t|j�S)N)r�r+)rr
r
rr��sz&ReadOnlySequentialNamedNodeMap.__len__cCs
t|j�S)N)r�r+)rr
r
rr��sz*ReadOnlySequentialNamedNodeMap._get_lengthcCs+x$|jD]}|j|kr
|Sq
WdS)N)r+r�)rr�r�r
r
rr��sz+ReadOnlySequentialNamedNodeMap.getNamedItemcCs:x3|jD](}|j|kr
|j|kr
|Sq
WdS)N)r+rtry)rrtryr�r
r
rr��sz-ReadOnlySequentialNamedNodeMap.getNamedItemNScCsLt|t�r!|j|�}n|j|�}|dkrHt|��|S)N)r�r,r�r�r])rZ
name_or_tuplerAr
r
rr��sz*ReadOnlySequentialNamedNodeMap.__getitem__cCs<|dkrdSy|j|SWntk
r7dSYnXdS)Nr)r+r�)rr6r
r
rr��s
z#ReadOnlySequentialNamedNodeMap.itemcCstjjd��dS)Nz"NamedNodeMap instance is read-only)r/r0r)rr�r
r
rr��s	z.ReadOnlySequentialNamedNodeMap.removeNamedItemcCstjjd��dS)Nz"NamedNodeMap instance is read-only)r/r0r)rrtryr
r
rr��s	z0ReadOnlySequentialNamedNodeMap.removeNamedItemNScCstjjd��dS)Nz"NamedNodeMap instance is read-only)r/r0r)rrAr
r
rr��s	z+ReadOnlySequentialNamedNodeMap.setNamedItemcCstjjd��dS)Nz"NamedNodeMap instance is read-only)r/r0r)rrAr
r
rr��s	z-ReadOnlySequentialNamedNodeMap.setNamedItemNScCs
|jgS)N)r+)rr
r
rr��sz+ReadOnlySequentialNamedNodeMap.__getstate__cCs|d|_dS)Nr)r+)rr�r
r
rr��sz+ReadOnlySequentialNamedNodeMap.__setstate__N)r+)rqrrrsr�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:eZdZd
Zdd�Zdd�Zdd�Zd	S)�
Identified�publicId�systemIdcCs||_||_dS)N)r.r/)rr.r/r
r
r�_identified_mixin_init�s	z!Identified._identified_mixin_initcCs|jS)N)r.)rr
r
r�
_get_publicId�szIdentified._get_publicIdcCs|jS)N)r/)rr
r
r�
_get_systemId�szIdentified._get_systemIdN)r.r/)rqrrrsr�r0r1r2r
r
r
rr-�sr-c@speZdZejZdZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dddd	d
�ZdS)�DocumentTypeNcCsIt�|_t�|_|r9t|�\}}||_|j|_dS)N)r*�entities�	notationsr�r�r�)rr�rur�r
r
rr�	s	zDocumentType.__init__cCs|jS)N)�internalSubset)rr
r
r�_get_internalSubsetsz DocumentType._get_internalSubsetcCsY|jdkrQtd�}|j|_|j|_tjjj}|r:g|j_	g|j
_	xU|j
j	D]G}t|j|j|j
�}|j
j	j|�|j|||�qmWx|jj	D]q}t|j|j|j
|j�}|j|_|j|_|j|_|jj	j|�|j|||�q�W|j|||�|SdSdS)N)rOr3r�r�r/r0�UserDataHandler�NODE_CLONEDr4r+r5�Notationr.r/rIrk�Entity�notationName�actualEncodingrrU)rrP�clonerhr��notation�e�entityr
r
rrQs.zDocumentType.cloneNodercCs�|jd�|j|j�|jrL|jd||j||jf�n#|jro|jd||jf�|jdk	r�|jd�|j|j�|jd�|jd|�dS)Nz
<!DOCTYPE z%s  PUBLIC '%s'%s  '%s'z%s  SYSTEM '%s'z [�]r~)r�r�r.r/r6)rr"r rr!r
r
rr/s
			

zDocumentType.writexml)rqrrrsr	�DOCUMENT_TYPE_NODErr�r�r.r/r6r�r7rQrr
r
r
rr3s	r3c@s�eZdZdZejZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)r;NcCs2||_||_t�|_|j||�dS)N)r�r<rlr$r0)rr�r.r/r?r
r
rr�Fs		zEntity.__init__cCs|jS)N)r=)rr
r
r�_get_actualEncodingLszEntity._get_actualEncodingcCs|jS)N)r)rr
r
r�
_get_encodingOszEntity._get_encodingcCs|jS)N)rU)rr
r
r�_get_versionRszEntity._get_versioncCstjjd��dS)Nz(cannot append children to an entity node)r/r0r1)rr>r
r
rr5Us	zEntity.appendChildcCstjjd��dS)Nz+cannot insert children below an entity node)r/r0r1)rr>r?r
r
rr-Ys	zEntity.insertBeforecCstjjd��dS)Nz*cannot remove children from an entity node)r/r0r1)rrCr
r
rr4]s	zEntity.removeChildcCstjjd��dS)Nz)cannot replace children of an entity node)r/r0r1)rr>rCr
r
rrDas	zEntity.replaceChild)rqrrrsr�r	ZENTITY_NODErr�r=rrUr�rDrErFr5r-r4rDr
r
r
rr;=s	r;c@s+eZdZejZdZdd�ZdS)r:NcCs||_|j||�dS)N)r�r0)rr�r.r/r
r
rr�is	zNotation.__init__)rqrrrsr	r�rr�r�r
r
r
rr:es	r:c	@sjeZdZddddddddgZdd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)�DOMImplementation�core�1.0�2.0Nr/�ls-load�3.0cCs+|dkrd}|j�|f|jkS)Nr)�lower�	_features)rrTrUr
r
rrSyszDOMImplementation.hasFeaturec	Cs6|r'|jdk	r'tjjd��|j�}|dkoT|dkoT|dk}|rw|rwtjjd��|r
t|�\}}|dkr�|dkr�tjjd��|r�|r�tjjd��|j||�}|r�|j	|�|j	|�|r ||_|_
||_||_|S)Nz(doctype object owned by another DOM treezElement with no namer/z$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces)
r3r/r0�WrongDocumentErr�_create_documentZInvalidCharacterErrr�r��createElementNSr5rO�doctyperR)	rrtr�rRrwZadd_root_elementrur�rr
r
r�createDocument~s4		



		

		z DOMImplementation.createDocumentcCs"t|�}||_||_|S)N)r3r.r/)rr�r.r/rRr
r
r�createDocumentType�s		z$DOMImplementation.createDocumentTypecCs|j|d�r|SdSdS)N)rS)rrTr
r
rrZ�szDOMImplementation.getInterfacecCst�S)N)�Document)rr
r
rrP�sz"DOMImplementation._create_document)rHrI)rHrJ)rHN)r/rI)r/rJ)r/N)rKrL)rKN)	rqrrrsrNrSrSrTrZrPr
r
r
rrGns	-rGc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�ElementInfor�cCs
||_dS)N)r�)rr�r
r
rr��szElementInfo.__init__cCstS)N)r�)r�anamer
r
rr��szElementInfo.getAttributeTypecCstS)N)r�)rrtryr
r
rr��szElementInfo.getAttributeTypeNScCsdS)NFr
)rr
r
rr%�szElementInfo.isElementContentcCsdS)NFr
)rr
r
r�isEmpty�szElementInfo.isEmptycCsdS)NFr
)rrWr
r
rr��szElementInfo.isIdcCsdS)NFr
)rrtryr
r
rr��szElementInfo.isIdNScCs|jS)N)r�)rr
r
rr��szElementInfo.__getstate__cCs
||_dS)N)r�)rr�r
r
rr��szElementInfo.__setstate__N)r�)
rqrrrsr�r�r�r�r%rXr�r�r�r�r
r
r
rrV�s	rVcCsW|jtjkr+|jj�d|_n(t|�rS|jjj�d|j_dS)N)rr	r�	_id_cache�clear�_id_search_stackrzrO)rAr
r
rr:�s
r:c@s0eZdZdMZejejejejfZ	e
�ZejZ
dZdZdZdZdZZdZdZdZdZdZdZdZd	Zd
d�Zdd
�Zdd�Zdd�Zdd�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/�Z.d0d1�Z/d2d3�Z0d4d5�Z1d6d7�Z2d8d9�Z3d:d;�Z4d<d=�Z5d>d?�Z6d@dA�Z7dBdC�Z8dDdE�Z9dFdG�Z:dHdHdHddIdJ�Z;dKdL�Z<dS)NrU�
_elem_inforRr[r$rYz	#documentNFrcCs4d|_t�|_i|_i|_d|_dS)N)rRrlr$r\rYr[)rr
r
rr�
s
			zDocument.__init__cCs7|jr|j|jf}n	|j}|jj|�S)N)rtryr�r\r�)rrr^r
r
rr�s		zDocument._get_elem_infocCs|jS)N)r=)rr
r
rrDszDocument._get_actualEncodingcCs|jS)N)rR)rr
r
r�_get_doctypeszDocument._get_doctypecCs|jS)N)�documentURI)rr
r
r�_get_documentURI szDocument._get_documentURIcCs|jS)N)r)rr
r
rrE#szDocument._get_encodingcCs|jS)N)�errorHandler)rr
r
r�_get_errorHandler&szDocument._get_errorHandlercCs|jS)N)�
standalone)rr
r
r�_get_standalone)szDocument._get_standalonecCs|jS)N)�strictErrorChecking)rr
r
r�_get_strictErrorChecking,sz!Document._get_strictErrorCheckingcCs|jS)N)rU)rr
r
rrF/szDocument._get_versioncCs�|j|jkr:tjjdt|�t|�f��|jdk	rY|jj|�|jtj	kr�|j
�r�tjjd��tj||�S)Nz%s cannot be child of %sz two document elements disallowed)rr.r/r0r1r2r3r4r	rJ�_get_documentElementr5)rrAr
r
rr52s			zDocument.appendChildcCsmy|jj|�Wn!tk
r7tjj��YnXd|_|_d|_|j	|krid|_	|S)N)
r$rEr7r/r0r8r<r=r3�documentElement)rrCr
r
rr4Bs
		zDocument.removeChildcCs.x'|jD]}|jtjkr
|Sq
WdS)N)r$rr	rJ)rrAr
r
rrfNszDocument._get_documentElementcCs6|jdk	r%|jj�d|_tj|�dS)N)rRrHr	)rr
r
rrHSs
	zDocument.unlinkcCs�|s
dS|jjddd�}|j|_|j|_|j|_xl|jD]a}t|||�}|jj|�|jt	j
kr�n|jt	jkr�||_||_
qPW|jtjjj||�|S)N)rRrSrrbrUr$rNrIrr	rrCrRr3rkr/r0r8r9)rrPr>r�Z
childcloner
r
rrQYs"	

zDocument.cloneNodecCst�}||_|S)N)r�rO)rrbr
r
r�createDocumentFragmentns		zDocument.createDocumentFragmentcCst|�}||_|S)N)r�rO)rr�r@r
r
r�
createElementss	zDocument.createElementcCs:t|t�std��t�}||_||_|S)Nznode contents must be a string)r�r�r�r�rGrO)rrG�tr
r
r�createTextNodexs			zDocument.createTextNodecCs:t|t�std��t�}||_||_|S)Nznode contents must be a string)r�r�r�r(rGrO)rrGr@r
r
r�createCDATASection�s			zDocument.createCDATASectioncCst|�}||_|S)N)r'rO)rrGr@r
r
r�
createComment�s	zDocument.createCommentcCst||�}||_|S)N)r
rO)rrrG�pr
r
r�createProcessingInstruction�s	z$Document.createProcessingInstructioncCs"t|�}||_d|_|S)Nr)r�rOr�)rr��ar
r
r�createAttribute�s		zDocument.createAttributecCs1t|�\}}t|||�}||_|S)N)r�r�rO)rrtr�ruryr@r
r
rrQ�s	zDocument.createElementNScCs=t|�\}}t||||�}||_d|_|S)Nr)r�r�rOr�)rrtr�ruryrpr
r
r�createAttributeNS�s
		zDocument.createAttributeNScCs"t||||�}||_|S)N)r;rO)rr�r.r/r<r@r
r
r�_create_entity�s	zDocument._create_entitycCst|||�}||_|S)N)r:rO)rr�r.r/r�r
r
r�_create_notation�s	zDocument._create_notationcCs||jkr|j|S|jp)|js0dS|j}|dkr]|jg}||_n
|sgdSd}x�|r|j�}|jdd�|jD��|j|�}|r�xI|j	j
�D]�}|jr |j|j|j
�r�||j|j<|j|kr|}q�|js�Pq�|j|j�rg||j|j<|j|krZ|}q�|js�Pq�|jr�||j|j<|j|kr�|}q�|jdkr�Pq�WnQ|jrxE|j	j
�D]4}|jr�||j|j<|j|kr�|}q�W|dk	rpPqpW|S)NcSs%g|]}|jtkr|�qSr
)rr9)�.0rMr
r
r�
<listcomp>�s	z+Document.getElementById.<locals>.<listcomp>r()rYr\r�r[rg�pop�extendr$r�r�r�rtr�ryr�r�r�r�r�)rr��stack�resultrAr�r�r
r
r�getElementById�sZ											
zDocument.getElementByIdcCst||t��S)N)r�rl)rr�r
r
rr��szDocument.getElementsByTagNamecCst|||t��S)N)r�rl)rrtryr
r
rr��szDocument.getElementsByTagNameNScCs|jj||�S)N)rRrS)rrTrUr
r
rrV�szDocument.isSupportedcCs[|jtjkr'tjjd��n$|jtjkrKtjjd��t|||�S)Nzcannot import document nodesz!cannot import document type nodes)rr	rr/r0�NotSupportedErrrCrN)rrArPr
r
r�
importNode�s
zDocument.importNodercCse|dkr |jd|�n|jd||f�x'|jD]}|j||||�qAWdS)Nz<?xml version="1.0" ?>z%<?xml version="1.0" encoding="%s"?>%s)r�r$r)rr"r rr!rrAr
r
rr�s	zDocument.writexmlcCs�|j|k	r.tjjd||jf��|jtjtjfkr[tjjd��|t	krd|kr�|j
dd�\}}|dkr|tjjkrtjjd��q|dkr|tjjkr|jtjkrtjjd��d}|}nd}d}|jtjkr[|j
}|dk	ra|j}|j|�nd}||_||_||_||_|jtjkr�||_n5||_|dk	r�|j|�|r�|j|�|S)Nz?cannot rename nodes from other documents;
expected %s,
found %sz8renameNode() only applies to element and attribute nodesr�r(r�zillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rOr/r0rOrr	rJr�r|rr�rr�r�r�r�rur�rtr�r�r�r�r)rr�rtr�ruryrZis_idr
r
r�
renameNodesR														

zDocument.renameNode)r\rRr[r$rY)=rqrrrsr�r	rJr�r�rCr.rGrRrrr�r�r�r3r=r<r=rrbrUrdr`r^r�r�r�rDr]r_rErarcrerFr5r4rfrHrQrhrirkrlrmrorqrQrrrsrtr{r�r�rVr}rr~r
r
r
rrU�sh		
	
:rUrgz#Top-level element of this document.c
Cs�|jj|�r$tjjj}ntjjj}|jtj	kr�|j
|j|j�}xW|j
j�D]F}|j|j|j|j�|j|j|j�}|j|_qmW|r�x|jD]%}t|||�}|j|�q�Wn�|jtjkrM|j�}|r�x�|jD]%}t|||�}|j|�q!Wnv|jtjkrt|j|j�}nO|jtjkr�|j|j�}n(|jtjkr�|j|j |j�}n�|jtj!kr�|j"|j�}n�|jtj#kr1|j$|j|j�}d|_|j|_n�|jtj%kr�tjjj}|j&j'|j(|j)|j*�}||_|r�g|j+_,g|j-_,xm|j-j,D]_}	t.|	j|	j)|	j*�}
||
_|j-j,j/|
�t0|	d�r�|	j1||	|
�q�Wx�|j+j,D]�}t2|j|j)|j*|j3�}|j4|_4|j5|_5|j6|_6||_|j+j,j/|�t0|d�r|j1||	|�qWntjj7dt8|���t0|d�r�|j1|||�|S)NTrkzCannot clone node %s)9rOrYr/r0r8r9Z
NODE_IMPORTEDrr	rJrQrtr�r�r�r�r�r�ryr�r$rNr5r+rhrFrkrGr�rlr�rorr�rmr�rrrCrRrTr�r.r/r4r+r5r:rIrdrkr;r<r=rrUr|r2)
rArPZnewOwnerDocumentrhr>r�rprMr@r�r?r@rAr
r
rrNAs|					rNcCs:|jdd�}t|�dkr(|Sd|dfSdS)Nr�r(�r)r�r�)r�Zfieldsr
r
rr��sr�cCs<|||�}|j�\}}|j|�|j�|S)N)ZgetEventZ
expandNoderZ)�func�args�kwargs�eventsZtoktypeZrootNoder
r
r�_do_pulldom_parse�s


r�cCsf|dkr0|r0ddlm}|j|�Sddlm}t|j|fd|d|i�SdS)Nr)�expatbuilder)�pulldom�parser�bufsize)�xml.domr��parser�r�)�filer�r�r�r�r
r
rr��s
r�cCsY|dkr)ddlm}|j|�Sddlm}t|j|fd|i�SdS)Nr)r�)r�r�)r�r��parseStringr�r�)�stringr�r�r�r
r
rr��s
r�cCs[|rTt|t�r$tj|�}x-|D]%\}}tjj||�s+dSq+WtjS)N)r�r�rZ_parse_feature_stringrUrRrS)Zfeatures�f�vr
r
r�getDOMImplementation�sr�)6rr�r/rrrrZxml.dom.minicompatZxml.dom.xmlbuilderrrr0r	rJr�r9ZdefpropertyrBrzr�r�r�r�r��objectr�Z
AttributeListr�r�r�r�r	r
rr�r$rr'r(r*r-r3r;r:rGrVr:rUrNr�r�r�r�r�r
r
r
r�<module>s�"
�
	y��)GU	><(	O*�OR


?>