Your IP : 3.145.51.35


Current Path : /usr/lib64/python3.6/xml/dom/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/xml/dom/__pycache__/minidom.cpython-36.opt-2.pyc

3


 \�@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
�'/usr/lib64/python3.6/xml/dom/minidom.py�__bool__+sz
Node.__bool__cCs|jdd|�S)N�)�toprettyxml)r�encodingr
r
r�toxml.sz
Node.toxml�	�
cCsx|dkrtj�}ntjtj�|ddd�}|jtjkrH|j|d|||�n|j|d||�|dkrh|j�S|j	�j�SdS)N�xmlcharrefreplacer)r�errors�newliner)
�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_firstChildIszNode._get_firstChildcCs|jr|jdSdS)N����)r$)rr
r
r�_get_lastChildMszNode._get_lastChildcCs|j|jkr0xt|j�D]}|j||�qW|S|j|jkrXtjjdt	|�t	|�f��|j
dk	rn|j
j|�|dkr�|j|�n�y|jj
|�}Wntk
r�tjj��YnX|jtkr�t|�|jj||�||_||_|r�|j|d}||_||_nd|_||_
|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.xt|j�D]}|j|�qW|S|j|jkrXtjjdt	|�t	|�f��n|jt
krjt|�|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.appendChildcCs|j|jkr(|j}|j|�|j||�S|j|jkrPtjjdt	|�t	|�f��||kr\dS|j
dk	rr|j
j|�y|jj|�}Wnt
k
r�tjj��YnX||j|<||_
d|_
|jtks�|jtkr�t|�|j|_|j|_d|_d|_|jr�||j_|j�r||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|�Wntk
r.tjj��YnX|jdk	rD|j|j_|jdk	rX|j|j_d|_|_|jt	krvt
|�d|_|S)N)r$�remover7r/r0r8r<r=rr9r:r3)rrCr
r
rr4�s




zNode.removeChildcCs�g}x�|jD]�}|jtjkr�|jsL|r2|j|d_|jrB|j|j_|j�q�|r�|dj|jkr�|d}|j|j|_|j|_|jr�||j_|j�q�|j|�q|j|�|jtj	kr|j
�qW||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�szNode.getInterfacecCs,y|j|dSttfk
r&dSXdS)Nr)�
_user_data�AttributeError�KeyError)r�keyr
r
r�getUserData�szNode.getUserDatacCsnd}y
|j}Wntk
r,i}||_YnX||krB||d}|dkr^d}|dk	rj||=n||f||<|S)Nr)r[r\)rr^rG�handler�old�dr
r
r�setUserData�s
zNode.setUserDatacCsHt|d�rDx8t|jj��D]&\}\}}|dk	r|j|||||�qWdS)Nr[)�hasattr�listr[�itemsZhandle)r�	operation�src�dstr^rGr`r
r
r�_call_user_data_handler�s
zNode._call_user_data_handlercCsBd|_|_|jr2x|jD]}|j�qWt�|_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)rZetZev�tbr
r
r�__exit__sz
Node.__exit__)N)rrN)!�__name__�
__module__�__qualname__�namespaceURIr3rOr<r=r�prefixr
rrr%r&r'r*r-r5rDr4rKrQrVrWrYrZr_rcrjrHrlrnr
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}||_||_|j|�||_dS)Nr(r))r$r=r<rIr3)rrAr$Zlastr
r
rrBs
rBcCs(x"|dk	r"|jtjkrdS|j}qWdS)NTF)rr	rr3)rAr
r
r�_in_document&s


rxcCs6|r2|jdd�jdd�jdd�jdd�}|j|�dS)	N�&z&amp;�<z&lt;�"z&quot;�>z&gt;)�replace�write)r"rGr
r
r�_write_data.srcCsHxB|jD]8}|jtjkr4|dks*|j|kr4|j|�t|||�qW|S)Nr)r$rr	rJ�tagNamerI�_get_elements_by_tagName_helper)�parent�name�rcrAr
r
rr�5s
r�cCs\xV|jD]L}|jtjkr|dks*|j|krF|dks<|j|krF|j|�t||||�qW|S)Nr)r$rr	rJrwrrrI�"_get_elements_by_tagName_ns_helper)r�ZnsURIrwr�rAr
r
rr�=s
r�c@sJeZdZejZdZdZdZdZ	ej
ejejej
ejejejfZdd�ZdS)�DocumentFragmentz#document-fragmentNcCst�|_dS)N)rkr$)rr
r
r�__init__TszDocumentFragment.__init__)rorprqr	r+r�nodeName�	nodeValue�
attributesr3rJrF�CDATA_SECTION_NODE�ENTITY_REFERENCE_NODE�PROCESSING_INSTRUCTION_NODE�COMMENT_NODE�
NOTATION_NODEr.r�r
r
r
rr�Fsr�c@s�eZdZd#ZejZd	Zd
Zd
Z	ej
ejfZe
d	d	fdd�Zd
d�Zdd�Zdd�Zdd�Zeee�ZZdd�Zdd�Zeee�ZZdd�Zdd�Zeee�Zdd�Zdd �Zd!d"�Zd	S)$�Attr�_name�_valuerr�_prefixr$�
_localNamerO�ownerElementNFcCs2d|_||_||_||_t�|_|jjt��dS)N)r�r�rrr�rkr$rI�Text)r�qNamerrrwrsr
r
rr�bsz
Attr.__init__cCs.y|jStk
r(|jjdd�dSXdS)N�:r(r))r�r\r��split)rr
r
rrWoszAttr._get_localNamecCs|jS)N)�	specified)rr
r
r�_get_specifieduszAttr._get_specifiedcCs|jS)N)r�)rr
r
r�	_get_namexszAttr._get_namecCs||_|jdk	rt|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_valuecCs6||_||jd_|jdk	r&t|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_prefixcCsd|j}|dkr&|r&|tkr&tjjd��||_|dkr<|j}nd||jf}|jrZt|j�||_	dS)N�xmlnsz5illegal use of 'xmlns' prefix for the wrong namespacez%s:%s)
rrrr/r0�NamespaceErrr�rwr�r:r�)rrsZnsuriZnewNamer
r
r�_set_prefix�s
zAttr._set_prefixcCsz|j}|dk	rR|j|j=|j|j|jf=|jrRd|_|jd8_|jj	d8_	x|j
D]}|j�qZW|j
dd�=dS)NFr()r��_attrsr��_attrsNSrrrw�_is_id�_magic_id_nodesrO�_magic_id_countr$rH)r�elemrMr
r
rrH�s
zAttr.unlinkcCsf|jr
dS|j}|j}|dks&|dkr*dS|j|�}|dkr@dS|jrV|j|j|j�S|j|j�SdS)NTF)	r�rOr��_get_elem_inforr�isIdNSrw�isIdr�)rrur��infor
r
r�	_get_isId�s
zAttr._get_isIdcCs\|j}|j}|dks|dkr tS|j|�}|dkr6tS|jrL|j|j|j�S|j|j�SdS)N)	rOr��_no_typer�rr�getAttributeTypeNSrw�getAttributeTyper�)rrur�r�r
r
r�_get_schemaType�s
zAttr._get_schemaType)r�r�rrr�r$r�rOr�) rorprq�	__slots__r	�ATTRIBUTE_NODErr�r�r�rFr�r.rr�rWr�r�r��propertyr�r�r�r�r�r�r�r�rsrHr�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@s�eZdZd;Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zd<dd�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��szNamedNodeMap.__init__cCs
t|j�S)N)�lenr�)rr
r
r�_get_length�szNamedNodeMap._get_lengthcCs0y|t|jj��|Stk
r*dSXdS)N)rer��keys�
IndexError)rr6r
r
r�item�szNamedNodeMap.itemcCs.g}x$|jj�D]}|j|j|jf�qW|S)N)r��valuesrIr�r�)rrLrAr
r
rrf�szNamedNodeMap.itemscCs4g}x*|jj�D]}|j|j|jf|jf�qW|S)N)r�r�rIrrrwr�)rrLrAr
r
r�itemsNS�szNamedNodeMap.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.getcCs:|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__$s

zNamedNodeMap.__getitem__cCsvt|t�rRy|j|}Wn0tk
rHt|�}|jj|_|j|�YnX||_n t|t�sdt	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|Stk
rdSXdS)N)r�r])rr�r
r
r�getNamedItem:s
zNamedNodeMap.getNamedItemcCs(y|j||fStk
r"dSXdS)N)r�r])rrrrwr
r
r�getNamedItemNS@szNamedNodeMap.getNamedItemNScCsX|j|�}|dk	rJt|j�|j|j=|j|j|jf=t|d�rFd|_	|St
jj��dS)Nr�)
r�r:r�r�r�r�rrrwrdr�r/r0r8)rr��nr
r
r�removeNamedItemFs



zNamedNodeMap.removeNamedItemcCsZ|j||�}|dk	rLt|j�|j|j|jf=|j|j=t|d�rHd|_	|St
jj��dS)Nr�)
r�r:r�r�rrrwr�r�rdr�r/r0r8)rrrrwr�r
r
r�removeNamedItemNSRs


zNamedNodeMap.removeNamedItemNScCstt|t�s&tjjdt|�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�rrrwr�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�)N) rorprqr�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�Zlengthz$Number of nodes in the NamedNodeMap.c@s0eZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)
�TypeInfo�	namespacer�cCs||_||_dS)N)r�r�)rr�r�r
r
rr��szTypeInfo.__init__cCs2|jrd|jj|j|jfSd|jj|jfSdS)Nz<%s %r (from %r)>z<%s %r>)r��	__class__ror�)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�)rorprqr�r�r�r�r�r
r
r
rr�s
r�c@s eZdZdDZejZd
ZeZ	dZ
ejejejej
ejejfZed
d
fdd�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'dEd8d9�Z(d:d;�Z)d<d=�Z*d>d?�Z+d@dA�Z,dBdC�Z-d
S)F�ElementrOr3r�r�rsrrr�r$r�r�r<r=NrcCsBd|_||_|_||_||_t�|_d|_|_d|_	d|_
dS)N)r3r�r�rsrrrkr$r<r=r�r�)rr�rrrsrwr
r
rr��s
zElement.__init__cCs|jdkri|_i|_dS)N)r�r�)rr
r
r�_ensure_attributes�s
zElement._ensure_attributescCs.y|jStk
r(|jjdd�dSXdS)Nr�r(r))r�r\r�r�)rr
r
rrW�szElement._get_localNamecCs|jS)N)r�)rr
r
r�_get_tagName�szElement._get_tagNamecCsD|jdk	r*xt|jj��D]}|j�qWd|_d|_tj|�dS)N)r�rer�rHr�r	)r�attrr
r
rrH�s
zElement.unlinkcCs4|jdkrdSy|j|jStk
r.dSXdS)Nr)r�r�r])rr�r
r
r�getAttribute�s
zElement.getAttributecCs8|jdkrdSy|j||fjStk
r2dSXdS)Nr)r�r�r])rrrrwr
r
r�getAttributeNS�s
zElement.getAttributeNScCsV|j|�}|dkr4t|�}||_|j|_|j|�n||jkrR||_|jrRt|�dS)N)�getAttributeNoder�r�rO�setAttributeNoder�r:)rr�r�r�r
r
r�setAttribute�s

zElement.setAttributecCs�t|�\}}|j||�}|dkrHt||||�}||_|j|_|j|�n4||jkrf||_|jrft|�|j|kr|||_||_	dS)N)
�_nssplit�getAttributeNodeNSr�r�rOr�r�r:rsr�)rrr�
qualifiedNamer�rs�	localnamer�r
r
r�setAttributeNS�s

zElement.setAttributeNScCs|jdkrdS|jj|�S)N)r�r�)rZattrnamer
r
rr��s
zElement.getAttributeNodecCs|jdkrdS|jj||f�S)N)r�r�)rrrrwr
r
rr�s
zElement.getAttributeNodeNScCs�|jd|fkrtjjd��|j�|jj|jd�}|dk	rD|j|�|j	j|j
|jfd�}|dk	rt||k	rt|j|�t||�||k	r�|S||k	r�|SdS)Nzattribute node already owned)
r�r/r0ZInuseAttributeErrr�r�r�r��removeAttributeNoder�rrrw�_set_attribute_node)rr�Zold1Zold2r
r
rr�s


zElement.setAttributeNodecCsP|jdkrtjj��y|j|}Wntk
r@tjj��YnX|j|�dS)N)r�r/r0r8r�r]r�)rr�r�r
r
r�removeAttributes

zElement.removeAttributecCsT|jdkrtjj��y|j||f}Wntk
rDtjj��YnX|j|�dS)N)r�r/r0r8r]r�)rrrrwr�r
r
r�removeAttributeNS%s

zElement.removeAttributeNScCs^|dkrtjj��y|j|jWntk
r@tjj��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=s
zElement.hasAttributecCs|jdkrdS||f|jkS)NF)r�)rrrrwr
r
r�hasAttributeNSBs
zElement.hasAttributeNScCst||t��S)N)r�rk)rr�r
r
r�getElementsByTagNameGszElement.getElementsByTagNamecCst|||t��S)N)r�rk)rrrrwr
r
r�getElementsByTagNameNSJszElement.getElementsByTagNameNScCsd|jt|�fS)Nz<DOM Element: %s at %#x>)r�r�)rr
r
rr�NszElement.__repr__rc	Cs|j|d|j�|j�}t|j��}x4|D],}|jd|�t|||j�|jd�q.W|jr�|jd�t|j�dkr�|jdj	t
jkr�|jdj|ddd�n8|j|�x"|jD]}|j|||||�q�W|j|�|jd|j|f�n|jd	|�dS)
Nrzz %s="r{r|r(rrz</%s>%sz/>%s)
r~r��_get_attributes�sortedr�rr�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�lszElement._get_attributescCs|jr
dSdSdS)NTF)r�)rr
r
r�
hasAttributespszElement.hasAttributescCs|j|�}|j|�dS)N)r��setIdAttributeNode)rr��idAttrr
r
r�setIdAttributexs
zElement.setIdAttributecCs|j||�}|j|�dS)N)r�r�)rrrrwrr
r
r�setIdAttributeNS|szElement.setIdAttributeNScCsl|dks|j|j�r tjj��t|�dk	r6tjj��|jshd|_|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�rsrrr�r$r�r�r<r=)rrr).rorprqr�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�r�rrr�r
r
r
rr��sT		

r�r�z*NamedNodeMap of attributes on the element.z%Namespace-local name of this element.cCs8t|�|j�||j|j<||j|j|jf<||_dS)N)r:r�r�r�r�rrrwr�)�elementr�r
r
rr��s
r�c@sbeZdZfZdZe�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�szChildless.appendChildcCsdS)NFr
)rr
r
rr%�szChildless.hasChildNodescCstjj|jd��dS)Nz nodes do not have children)r/r0r1r�)rr>r?r
r
rr-�szChildless.insertBeforecCstjj|jd��dS)Nz nodes do not have children)r/r0r8r�)rrCr
r
rr4�szChildless.removeChildcCsdS)Nr
)rr
r
rrK�szChildless.normalizecCstjj|jd��dS)Nz nodes do not have children)r/r0r1r�)rr>rCr
r
rrD�szChildless.replaceChild)rorprqr�r�Z
EmptyNodeListr$rtrvr'r*r5r%r-r4rKrDr
r
r
rr�src@s\eZdZejZdZdd�Zdd�Zdd�Z	e
ee	�Zd	d
�Zdd�Z
e
ee
�Zddd�ZdS)�ProcessingInstruction�targetrGcCs||_||_dS)N)rrG)rrrGr
r
rr��szProcessingInstruction.__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 r�r!r
r
rr�szProcessingInstruction.writexmlN)rrG)rrr)rorprqr	r�rr�r�r	r
r�r�rrr�rr
r
r
rr�s

rc@sreZdZdZdd�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_datacCs6|j}t|�dkrd}nd}d|jj|dd�|fS)N�
z...rz<DOM %s node "%r%s">r)rGr�r�ro)rrGZ	dotdotdotr
r
rr��szCharacterData.__repr__cCsT|dkrtjjd��|t|j�kr.tjjd��|dkrBtjjd��|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.appendDatacCsZ|dkrtjjd��|t|j�kr.tjjd��|rVd|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.insertDatacCsl|dkrtjjd��|t|j�kr.tjjd��|dkrBtjjd��|rh|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.deleteDatacCsr|dkrtjjd��|t|j�kr.tjjd��|dkrBtjjd��|rnd|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<)rorprqr�r�r�r�rrr�rGr�r�rrrrrr
r
r
rr
�s			
r
zLength of the string data.c@sHeZdZfZejZdZdZdd�Z	ddd�Z
dd	�Zd
d�Zdd
�Z
dS)r�z#textNcCs�|dks|t|j�kr"tjjd��|j�}|j|d�|_|j|_|j}|jr~||jj	kr~|dkrp|jj
|�n|jj||�|jd|�|_|S)Nrzillegal offset value)r�rGr/r0rr�rOr<r3r$r5r-)rrZnewText�nextr
r
r�	splitText0szText.splitTextrcCst|d||j|f�dS)Nz%s%s%s)rrG)rr"r r�r!r
r
rr?sz
Text.writexmlcCs�|jg}|j}x6|dk	rD|jtjtjfkr@|jd|j�|j}qPqW|j}x4|dk	r�|jtjtjfkr||j|j�|j}qNPqNWdj	|�S)Nrr)
rGr=rr	rFr�r;r<rI�join)rrLr�r
r
r�_get_wholeTextDs

zText._get_wholeTextcCs�|j}|j}x6|dk	rB|jtjtjfkr>|j}|j|�|}qPqW|j}|sX|j|�x6|dk	r�|jtjtjfkr�|j}|j|�|}qZPqZW|r�||_|SdSdS)N)	r3r=rr	rFr�r4r<rG)rZcontentr�r�rr
r
r�replaceWholeTextVs*




zText.replaceWholeTextcCsF|jj�rdSt|�}|dkr"dS|jj|�}|dkr:dS|j�SdS)NF)rG�strip�_get_containing_elementrOr��isElementContent)rr�r�r
r
r�!_get_isWhitespaceInElementContentrs
z&Text._get_isWhitespaceInElementContent)rrr)rorprqr�r	rFrr�r�rrrrr#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}qWdS)N)r3rr	rJ)rAr@r
r
rr!�s

r!cCs.|j}x"|dk	r(|jtjkr |S|j}qWdS)N)r3rr	r�)rAr@r
r
rr�s

rc@s(eZdZejZdZdd�Zddd�ZdS)	�Commentz#commentcCstj|�||_dS)N)r
r�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 r�r!r
r
rr�s
zComment.writexmlN)rrr)	rorprqr	r�rr�r�rr
r
r
rr$�sr$c@s$eZdZfZejZdZddd�ZdS)�CDATASectionz#cdata-sectionrcCs,|jjd�dkrtd��|jd|j�dS)Nz]]>rz$']]>' not allowed in a CDATA sectionz<![CDATA[%s]]>)rG�findr7r~)rr"r r�r!r
r
rr�szCDATASection.writexmlN)rrr)	rorprqr�r	r�rr�rr
r
r
rr%�sr%c@s|eZdZdZffdd�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|SqWdS)N)r(r�)rr�r�r
r
rr��s
z+ReadOnlySequentialNamedNodeMap.getNamedItemcCs,x&|jD]}|j|kr|j|kr|SqWdS)N)r(rrrw)rrrrwr�r
r
rr��sz-ReadOnlySequentialNamedNodeMap.getNamedItemNScCs4t|t�r|j|�}n
|j|�}|dkr0t|��|S)N)r�r,r�r�r])rZ
name_or_tuplerAr
r
rr��s

z*ReadOnlySequentialNamedNodeMap.__getitem__cCs0|dkrdSy
|j|Stk
r*dSXdS)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��sz.ReadOnlySequentialNamedNodeMap.removeNamedItemcCstjjd��dS)Nz"NamedNodeMap instance is read-only)r/r0r)rrrrwr
r
rr��sz0ReadOnlySequentialNamedNodeMap.removeNamedItemNScCstjjd��dS)Nz"NamedNodeMap instance is read-only)r/r0r)rrAr
r
rr��sz+ReadOnlySequentialNamedNodeMap.setNamedItemcCstjjd��dS)Nz"NamedNodeMap instance is read-only)r/r0r)rrAr
r
rr��sz-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()rorprqr�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�sz!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,)rorprqr�r-r.r/r
r
r
rr*�sr*c@sHeZdZejZdZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dd	d
�ZdS)�DocumentTypeNcCs2t�|_t�|_|r&t|�\}}||_|j|_dS)N)r'�entities�	notationsr�r�r�)rr�rsr�r
r
rr�	szDocumentType.__init__cCs|jS)N)�internalSubset)rr
r
r�_get_internalSubsetsz DocumentType._get_internalSubsetcCs�|jdkr�td�}|j|_|j|_tjjj}|r�g|j_	g|j
_	x>|j
j	D]2}t|j|j|j
�}|j
j	j|�|j|||�qJWxZ|jj	D]N}t|j|j|j
|j�}|j|_|j|_|j|_|jj	j|�|j|||�q�W|j|||�|SdSdS)N)rOr0r�r�r/r0�UserDataHandler�NODE_CLONEDr1r(r2�Notationr+r,rIrj�Entity�notationName�actualEncodingrrU)rrP�clonergr��notation�e�entityr
r
rrQs.

zDocumentType.cloneNodercCs�|jd�|j|j�|jr8|jd||j||jf�n|jrR|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,r3)rr"r r�r!r
r
rr/s



zDocumentType.writexml)rrr)rorprqr	�DOCUMENT_TYPE_NODErr�r�r+r,r3r�r4rQrr
r
r
rr0sr0c@sfeZdZdZejZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)r8NcCs$||_||_t�|_|j||�dS)N)r�r9rkr$r-)rr�r+r,r<r
r
rr�FszEntity.__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r5UszEntity.appendChildcCstjjd��dS)Nz+cannot insert children below an entity node)r/r0r1)rr>r?r
r
rr-YszEntity.insertBeforecCstjjd��dS)Nz*cannot remove children from an entity node)r/r0r1)rrCr
r
rr4]szEntity.removeChildcCstjjd��dS)Nz)cannot replace children of an entity node)r/r0r1)rr>rCr
r
rrDaszEntity.replaceChild)rorprqr�r	ZENTITY_NODErr�r:rrUr�rArBrCr5r-r4rDr
r
r
rr8=sr8c@seZdZejZdZdd�ZdS)r7NcCs||_|j||�dS)N)r�r-)rr�r+r,r
r
rr�iszNotation.__init__)rorprqr	r�rr�r�r
r
r
rr7esr7c	@sHeZdZddddddddgZdd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)�DOMImplementation�core�1.0�2.0Nr/�ls-load�3.0cCs|dkrd}|j�|f|jkS)Nr)�lower�	_features)rrTrUr
r
rrSyszDOMImplementation.hasFeaturec	Cs�|r|jdk	rtjjd��|j�}|dko8|dko8|dk}|rR|rRtjjd��|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)	rrrr�rOruZadd_root_elementrsr�rr
r
r�createDocument~s4





z DOMImplementation.createDocumentcCst|�}||_||_|S)N)r0r+r,)rr�r+r,rOr
r
r�createDocumentType�sz$DOMImplementation.createDocumentTypecCs|j|d�r|SdSdS)N)rS)rrTr
r
rrZ�szDOMImplementation.getInterfacecCst�S)N)�Document)rr
r
rrM�sz"DOMImplementation._create_document)rErF)rErG)rEN)r/rF)r/rG)r/N)rHrI)rHN)	rorprqrKrSrPrQrZrMr
r
r
rrDns-rDc@sXeZdZdZdd�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�)rrrrwr
r
rr��szElementInfo.getAttributeTypeNScCsdS)NFr
)rr
r
rr"�szElementInfo.isElementContentcCsdS)NFr
)rr
r
r�isEmpty�szElementInfo.isEmptycCsdS)NFr
)rrTr
r
rr��szElementInfo.isIdcCsdS)NFr
)rrrrwr
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�)
rorprqr�r�r�r�r"rUr�r�r�r�r
r
r
rrS�s	rScCs>|jtjkr|jj�d|_nt|�r:|jjj�d|j_dS)N)rr	r�	_id_cache�clear�_id_search_stackrxrO)rAr
r
rr:�s
r:c@sreZdZdMZejejejejfZ	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:dNdIdJ�Z;dKdL�Z<dS)OrR�
_elem_inforOrXr$rVz	#documentNFrcCs$d|_t�|_i|_i|_d|_dS)N)rOrkr$rYrVrX)rr
r
rr�
s
zDocument.__init__cCs&|jr|j|jf}n|j}|jj|�S)N)rrrwr�rYr�)rrr^r
r
rr�szDocument._get_elem_infocCs|jS)N)r:)rr
r
rrAszDocument._get_actualEncodingcCs|jS)N)rO)rr
r
r�_get_doctypeszDocument._get_doctypecCs|jS)N)�documentURI)rr
r
r�_get_documentURI szDocument._get_documentURIcCs|jS)N)r)rr
r
rrB#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rC/szDocument._get_versioncCsj|j|jkr(tjjdt|�t|�f��|jdk	r>|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.appendChildcCsVy|jj|�Wntk
r.tjj��YnXd|_|_d|_|j	|krRd|_	|S)N)
r$rEr7r/r0r8r<r=r3�documentElement)rrCr
r
rr4Bs
zDocument.removeChildcCs$x|jD]}|jtjkr|SqWdS)N)r$rr	rJ)rrAr
r
rrcNszDocument._get_documentElementcCs(|jdk	r|jj�d|_tj|�dS)N)rOrHr	)rr
r
rrHSs

zDocument.unlinkcCs�|sdS|jjddd�}|j|_|j|_|j|_xL|jD]B}t|||�}|jj|�|jt	j
krbn|jt	jkrt||_||_
q8W|jtjjj||�|S)N)rRrPrr_rUr$rNrIrr	rr@rOr3rjr/r0r5r6)rrPr;r�Z
childcloner
r
rrQYs"
zDocument.cloneNodecCst�}||_|S)N)r�rO)rrbr
r
r�createDocumentFragmentnszDocument.createDocumentFragmentcCst|�}||_|S)N)r�rO)rr�r=r
r
r�
createElementsszDocument.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�szDocument.createCommentcCst||�}||_|S)N)rrO)rrrG�pr
r
r�createProcessingInstruction�s
z$Document.createProcessingInstructioncCst|�}||_d|_|S)Nr)r�rOr�)rr��ar
r
r�createAttribute�szDocument.createAttributecCs"t|�\}}t|||�}||_|S)N)r�r�rO)rrrr�rsrwr=r
r
rrN�szDocument.createElementNScCs*t|�\}}t||||�}||_d|_|S)Nr)r�r�rOr�)rrrr�rsrwrmr
r
r�createAttributeNS�s
zDocument.createAttributeNScCst||||�}||_|S)N)r8rO)rr�r+r,r9r=r
r
r�_create_entity�szDocument._create_entitycCst|||�}||_|S)N)r7rO)rr�r+r,r�r
r
r�_create_notation�szDocument._create_notationcCs�||jkr|j|S|jp|js$dS|j}|dkrB|jg}||_n|sJdSd}�x>|�r�|j�}|jdd�|jD��|j|�}|�r@x�|j	j
�D]�}|jr�|j|j|j
�r�||j|j<|j|kr�|}n|js�Pq�|j|j��r
||j|j<|j|k�r�|}n
|j�s:Pq�|jr�||j|j<|j|k�r.|}q�|jdkr�Pq�WnB|j�r�x8|j	j
�D]*}|j�rT||j|j<|j|k�rT|}�qTW|dk	rRPqRW|S)NcSsg|]}|jtkr|�qSr
)rr9)�.0rMr
r
r�
<listcomp>�sz+Document.getElementById.<locals>.<listcomp>r()rVrYr�rXrd�pop�extendr$r�r�r�rrr�rwr�r�r�r�r�)rr��stack�resultrAr�r�r
r
r�getElementById�sZ






zDocument.getElementByIdcCst||t��S)N)r�rk)rr�r
r
rr��szDocument.getElementsByTagNamecCst|||t��S)N)r�rk)rrrrwr
r
rr��szDocument.getElementsByTagNameNScCs|jj||�S)N)rRrS)rrTrUr
r
rrV�szDocument.isSupportedcCs>|jtjkrtjjd��n|jtjkr2tjjd��t|||�S)Nzcannot import document nodesz!cannot import document type nodes)rr	rr/r0�NotSupportedErrr@rN)rrArPr
r
r�
importNode�s
zDocument.importNodercCsN|dkr|jd|�n|jd||f�x|jD]}|j||||�q2WdS)Nz<?xml version="1.0" ?>z%<?xml version="1.0" encoding="%s"?>%s)r~r$r)rr"r r�r!rrAr
r
rr�szDocument.writexmlcCsJ|j|k	r tjjd||jf��|jtjtjfkr>tjjd��|t	kr�d|kr�|j
dd�\}}|dkr�|tjjkr�tjjd��q�|dkr�|tjjkr�|jtjkr�tjjd��d}|}nd}d}|jtjkr�|j
}|dk	r�|j}|j|�nd}||_||_||_||_|jtjk�r||_n*||_|dk	�rF|j|�|�rF|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/r0rLrr	rJr�ryrr�rr�r�r�r�rsr�rrr�r�r�r�r�)rr�rrr�rsrwrZis_idr
r
r�
renameNodesR



zDocument.renameNode)rYrOrXr$rV)rrrN)=rorprqr�r	rJr�r�r@r.rDrRrrr�r�r�r3r=r<r:rr_rUrar]r[r�r�r�rArZr\rBr^r`rbrCr5r4rcrHrQrerfrhrirjrlrnrNrorprqrxr�r�rVrzrr{r
r
r
rrR�sh	
:
rRrdz#Top-level element of this document.c
Cs�|jj|�rtjjj}n
tjjj}|jtj	kr�|j
|j|j�}x>|j
j�D]0}|j|j|j|j�|j|j|j�}|j|_qJW|r�x$|jD]}t|||�}|j|�q�W�n|jtjkr�|j�}|r�x$|jD]}t|||�}|j|�q�W�n�|jtjk�r|j|j�}�n�|jtjk�r*|j|j�}�n�|jtjk�rL|j|j |j�}�nr|jtj!k�rj|j"|j�}�nT|jtj#k�r�|j$|j|j�}d|_|j|_�n$|jtj%k�r�tjjj}|j&j'|j(|j)|j*�}||_|�r�g|j+_,g|j-_,xR|j-j,D]F}	t.|	j|	j)|	j*�}
||
_|j-j,j/|
�t0|	d��r�|	j1||	|
��q�Wx�|j+j,D]b}t2|j|j)|j*|j3�}|j4|_4|j5|_5|j6|_6||_|j+j,j/|�t0|d��rB|j1|||��qBWntjj7dt8|���t0|d��r�|j1|||�|S)NTrjzCannot clone node %s)9rOrYr/r0r5r6Z
NODE_IMPORTEDrr	rJrNrrr�r�r�r�r�r�rwr�r$rNr5r+rerFrhrGr�rir�rlrr�rjr�ror@rRrQr�r+r,r1r(r2r7rIrdrjr8r9r:rrUryr2)
rArPZnewOwnerDocumentrgr;r�rmrMr@r�r<r=r>r
r
rrNAs|

rNcCs,|jdd�}t|�dkr|Sd|dfSdS)Nr�r(�r)r�r�)r�Zfieldsr
r
rr��sr�cCs,|||�}|j�\}}|j|�|j�|S)N)ZgetEventZ
expandNoderW)�func�args�kwargsZeventsZtoktypeZrootNoder
r
r�_do_pulldom_parse�s


r�cCsJ|dkr$|r$ddlm}|j|�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|dkrddlm}|j|�Sddlm}t|j|fd|i�SdS)Nr)r�)r�r�)r�r��parseStringr�r�)�stringr�r�r�r
r
rr��s

r�cCsB|r<t|t�rtj|�}x"|D]\}}tjj||�sdSqWtjS)N)r�r�rZ_parse_feature_stringrRrRrS)Zfeatures�f�vr
r
r�getDOMImplementation�s

r�)NN)N)N)6rr�r/rrrrZxml.dom.minicompatZxml.dom.xmlbuilderrrr0r	rJr�r9ZdefpropertyrBrxrr�r�r�r��objectr�Z
AttributeListr�r�r�r�rrr
r�r!rr$r%r'r*r0r8r7rDrSr:rRrNr�r�r�r�r�r
r
r
r�<module>s�v
	y$
w)GU	><(	O*PR




?>