Your IP : 52.15.109.209


Current Path : /opt/alt/python38/lib64/python3.8/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/xml/dom/__pycache__/minidom.cpython-38.opt-1.pyc

U

i�f)�@s�dZddlZddlZddlmZmZmZmZddlTddl	m
Z
mZejj
jejj
jfZGdd�dejj
�Z
ee
dd	d
�ee
ddd
�ee
d
dd
�dd�Zdd�Zdd�Zdd�Zdd�ZGdd�de
�ZGdd�de
�Zeeddd
�eed
dd
�eed d!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/d0�d0�Z Gd1d2�d2e e
�Z!Gd3d4�d4e e
�Z"ee"d$d5d
�Gd6d7�d7e"�Z#ee#d8d9d
�ee#d:d;d
�d<d=�Z$d>d?�Z%Gd@dA�dAe"�Z&GdBdC�dCe#�Z'GdDdE�dEe�Z(ee(d$dFd
�GdGdH�dH�Z)GdIdJ�dJe)e e
�Z*GdKdL�dLe)e
�Z+GdMdN�dNe)e e
�Z,GdOdP�dPe
�Z-GdQdR�dRe�Z.dSdT�Z/GdUdV�dVe
e�Z0ee0dWdXd
�dYdZ�Z1d[d\�Z2d]d^�Z3ded_d`�Z4dfdadb�Z5dgdcdd�Z6dS)hacSimple 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@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/python38/lib64/python3.8/xml/dom/minidom.py�__bool__+sz
Node.__bool__cCs|�dd|�S�N�)�toprettyxml)r�encodingr
r
r
�toxml.sz
Node.toxml�	�
cCsx|dkrt��}ntjt��|ddd�}|jtjkrH|�|d|||�n|�|d||�|dkrh|��S|�	���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�
childNodesrr
r
r
�
hasChildNodesCszNode.hasChildNodescCs|jSr%�r'rr
r
r
�_get_childNodesFszNode._get_childNodescCs|jr|jdSdS�Nrr)rr
r
r
�_get_firstChildIszNode._get_firstChildcCs|jr|jdSdS�N���r)rr
r
r
�_get_lastChildMszNode._get_lastChildcCs
|j|jkr,t|j�D]}|�||�q|S|j|jkrTtj�dt	|�t	|�f��|j
dk	rj|j
�|�|dkr~|�|�n�z|j�
|�}Wntk
r�tj���YnX|jtkr�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
r4Qs8�

zNode.insertBeforecCs�|j|jkr*t|j�D]}|�|�q|S|j|jkrTtj�dt	|�t	|�f��n|jt
krft|�|jdk	r||j�
|�t||�d|_|S�Nr0)rr2r3r'r<r5r6r7r8r9r@rAr:r;�
_append_childrC)rrHrGr
r
r
r<qs�


zNode.appendChildcCs|j|jkr(|j}|�|�|�||�S|j|jkrPtj�dt	|�t	|�f��||kr\dS|j
dk	rr|j
�|�z|j�|�}Wnt
k
r�tj���YnX||j|<||_
d|_
|jtks�|jtkr�t|�|j|_|j|_d|_d|_|jr�||j_|j�r||j_|SrI)rr2rCr;r4r5r6r7r8r9r:r'r=r>r?r@rArD)rrE�oldChildrFr=r
r
r
�replaceChild�s@
�


�zNode.replaceChildcCs�z|j�|�Wntk
r.tj���YnX|jdk	rD|j|j_|jdk	rX|j|j_d|_|_|jt	krvt
|�d|_|Sr%)r'�remover>r6r7r?rCrDrr@rAr:�rrKr
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�datarCrD�unlink�append�ELEMENT_NODE�	normalize)r�L�childrHr
r
r
rT�s*





zNode.normalizecCst|||jp|�Sr%)�_clone_node�
ownerDocument)r�deepr
r
r
�	cloneNode�szNode.cloneNodecCs|jj�||�Sr%)rX�implementation�
hasFeature�r�feature�versionr
r
r
�isSupported�szNode.isSupportedcCsdSr%r
rr
r
r
�_get_localName�szNode._get_localNamecCs||kSr%r
�r�otherr
r
r
�
isSameNode�szNode.isSameNodecCs|�|d�r|SdSdSr%)r`�rr^r
r
r
�getInterface�szNode.getInterfacec	Cs0z|j|dWSttfk
r*YdSXdSr+)�
_user_data�AttributeError�KeyError�r�keyr
r
r
�getUserData�szNode.getUserDatacCsnd}z
|j}Wntk
r,i}||_YnX||krB||d}|dkr^d}|dk	rj||=n||f||<|Sr+)rgrh)rrkrP�handler�old�dr
r
r
�setUserData�s
zNode.setUserDatacCsDt|d�r@t|j���D]&\}\}}|dk	r|�|||||�qdS)Nrg)�hasattr�listrg�itemsZhandle)r�	operation�srcZdstrkrPrmr
r
r
�_call_user_data_handler�s
zNode._call_user_data_handlercCs>d|_|_|jr.|jD]}|��qt�|_d|_d|_dSr%)r:rXr'rQ�NodeListrDrC)rrVr
r
r
rQs

zNode.unlinkcCs|Sr%r
rr
r
r
�	__enter__szNode.__enter__cCs|��dSr%)rQ)rZetZev�tbr
r
r
�__exit__sz
Node.__exit__)N)rrN)!�__name__�
__module__�__qualname__�namespaceURIr:rXrCrDr�prefixrrrr(r*r,r/r4r<rLr;rTrZr`rardrfrlrprvrQrxrzr
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'rDrCrRr:)rrHr'Zlastr
r
r
rJs
rJcCs$|dk	r |jtjkrdS|j}qdS�NTF)rr	rr:�rHr
r
r
�_in_document&s
r�cCs6|r2|�dd��dd��dd��dd�}|�|�d	S)
zWrites datachars to writer.�&z&amp;�<z&lt;�"z&quot;�>z&gt;N)�replace�write)r$rPr
r
r
�_write_data.s��r�cCsD|jD]8}|jtjkr2|dks(|j|kr2|�|�t|||�q|S�Nr)r'rr	rS�tagNamerR�_get_elements_by_tagName_helper)�parent�name�rcrHr
r
r
r�5s
��
r�cCsX|jD]L}|jtjkr|dks(|j|krD|dks:|j|krD|�|�t||||�q|Sr�)r'rr	rSr�r~rR�"_get_elements_by_tagName_ns_helper)r�ZnsURIr�r�rHr
r
r
r�=s
��
r�c@sJeZdZejZdZdZdZdZ	ej
ejejej
ejejejfZdd�ZdS)�DocumentFragmentz#document-fragmentNcCst�|_dSr%)rwr'rr
r
r
�__init__TszDocumentFragment.__init__)r{r|r}r	r2r�nodeName�	nodeValue�
attributesr:rSrO�CDATA_SECTION_NODE�ENTITY_REFERENCE_NODE�PROCESSING_INSTRUCTION_NODE�COMMENT_NODE�
NOTATION_NODEr5r�r
r
r
r
r�Fs�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'�
_localNamerX�ownerElementNFcCs2d|_||_||_||_t�|_|j�t��dSr%)r�r�r~r�rwr'rR�Text)r�qNamer~r�rr
r
r
r�bsz
Attr.__init__cCs4z|jWStk
r.|j�dd�dYSXdS�N�:r1r.)r�rhr��splitrr
r
r
raoszAttr._get_localNamecCs|jSr%)�	specifiedrr
r
r
�_get_specifieduszAttr._get_specifiedcCs|jSr%)r�rr
r
r
�	_get_namexszAttr._get_namecCs||_|jdk	rt|j�dSr%)r�r�rA�r�valuer
r
r
�	_set_name{s
zAttr._set_namecCs|jSr%)r�rr
r
r
�
_get_value�szAttr._get_valuecCs6||_||jd_|jdk	r&t|j�||jd_dSr+)r�r'rPr�rAr�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��||_|dkr<|j}nd||jf}|jrZt|j�||_	dS)N�xmlnsz5illegal use of 'xmlns' prefix for the wrong namespacez%s:%s)
r~rr6r7�NamespaceErrr�r�r�rAr�)rrZnsuriZnewNamer
r
r
�_set_prefix�s�
zAttr._set_prefixcCsv|j}|dk	rR|j|j=|j|j|jf=|jrRd|_|jd8_|jj	d8_	|j
D]}|��qX|j
dd�=dS)NFr1)r��_attrsr��_attrsNSr~r��_is_id�_magic_id_nodesrX�_magic_id_countr'rQ)r�elemrVr
r
r
rQ�s


zAttr.unlinkcCsf|jr
dS|j}|j}|dks&|dkr*dS|�|�}|dkr@dS|jrV|�|j|j�S|�|j�SdSr�)	r�rXr��_get_elem_infor~�isIdNSr��isIdr��rr�r��infor
r
r
�	_get_isId�s
zAttr._get_isIdcCs\|j}|j}|dks|dkr tS|�|�}|dkr6tS|jrL|�|j|j�S|�|j�SdSr%)	rXr��_no_typer�r~�getAttributeTypeNSr��getAttributeTyper�r�r
r
r
�_get_schemaType�s
zAttr._get_schemaType) r{r|r}�	__slots__r	�ATTRIBUTE_NODErr�r�r�rOr�r5rr�rar�r�r��propertyr�r�r�r�r�r�r�r�rrQr�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�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
d:dd�ZeZdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z dS);�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��
_ownerElementcCs||_||_||_dSr%r�)r�attrsZattrsNSr�r
r
r
r��szNamedNodeMap.__init__cCs
t|j�Sr%)�lenr�rr
r
r
�_get_length�szNamedNodeMap._get_lengthcCs4z|t|j���|WStk
r.YdSXdSr%)rrr��keys�
IndexError�rr=r
r
r
�item�szNamedNodeMap.itemcCs*g}|j��D]}|�|j|jf�q|Sr%)r��valuesrRr�r��rrUrHr
r
r
rs�szNamedNodeMap.itemscCs0g}|j��D]}|�|j|jf|jf�q|Sr%)r�r�rRr~r�r�r�r
r
r
�itemsNS�szNamedNodeMap.itemsNScCs"t|t�r||jkS||jkSdSr%)�
isinstance�strr�r�rjr
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�krdSt|�t|�kt|�t|�kSdS)Nr�r)r��getattr�idrbr
r
r
�_cmpszNamedNodeMap._cmpcCs|�|�dkSr+�r�rbr
r
r
�__eq__szNamedNodeMap.__eq__cCs|�|�dkSr+r�rbr
r
r
�__ge__szNamedNodeMap.__ge__cCs|�|�dkSr+r�rbr
r
r
�__gt__szNamedNodeMap.__gt__cCs|�|�dkSr+r�rbr
r
r
�__le__szNamedNodeMap.__le__cCs|�|�dkSr+r�rbr
r
r
�__lt__!szNamedNodeMap.__lt__cCs"t|t�r|j|S|j|SdSr%)r�r3r�r�)r�attname_or_tupler
r
r
�__getitem__$s

zNamedNodeMap.__getitem__cCsvt|t�rRz|j|}Wn0tk
rHt|�}|jj|_|�|�YnX||_n t|t�sdt	d��|}|�|�dS)Nz%value must be a string or Attr object)
r�r�r�rir�r�rX�setNamedItemr��	TypeError)r�attnamer�rHr
r
r
�__setitem__+s


zNamedNodeMap.__setitem__cCs(z|j|WStk
r"YdSXdSr%)r�ri�rr�r
r
r
�getNamedItem:szNamedNodeMap.getNamedItemcCs,z|j||fWStk
r&YdSXdSr%)r�ri�rr~r�r
r
r
�getNamedItemNS@szNamedNodeMap.getNamedItemNScCsX|�|�}|dk	rJt|j�|j|j=|j|j|jf=t|d�rFd|_	|St
j���dS�Nr�)
r�rAr�r�r�r�r~r�rqr�r6r7r?�rr��nr
r
r
�removeNamedItemFs



zNamedNodeMap.removeNamedItemcCsZ|�||�}|dk	rLt|j�|j|j|jf=|j|j=t|d�rHd|_	|St
j���dSr�)
r�rAr�r�r~r�r�r�rqr�r6r7r?�rr~r�r�r
r
r
�removeNamedItemNSRs


zNamedNodeMap.removeNamedItemNScCstt|t�s&tj�dt|�t|�f��|j�|j�}|r@|�	�||j|j<||j
|j|jf<|j
|_t|j�|SrI)r�r�r6r7r8r9r�r�r�rQr�r~r�r�r�rA)rrHrnr
r
r
r�^s
�
zNamedNodeMap.setNamedItemcCs
|�|�Sr%)r��rrHr
r
r
�setNamedItemNSkszNamedNodeMap.setNamedItemNScCs||}t|j�|��dSr%)rAr�rQ)rr�rHr
r
r
�__delitem__ns
zNamedNodeMap.__delitem__cCs|j|j|jfSr%r�rr
r
r
�__getstate__sszNamedNodeMap.__getstate__cCs|\|_|_|_dSr%r��r�stater
r
r
�__setstate__vszNamedNodeMap.__setstate__)N)!r{r|r}�__doc__r�r�r�r�rsr�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)rXr:r�r�rr~r�r'r�r�rCrDNrcCsBd|_||_|_||_||_t�|_d|_|_d|_	d|_
dSr%)r:r�r�rr~rwr'rCrDr�r�)rr�r~rr�r
r
r
r��s
zElement.__init__cCs|jdkri|_i|_dSr%)r�r�rr
r
r
�_ensure_attributes�s
zElement._ensure_attributescCs4z|jWStk
r.|j�dd�dYSXdSr�)r�rhr�r�rr
r
r
ra�szElement._get_localNamecCs|jSr%�r�rr
r
r
�_get_tagName�szElement._get_tagNamecCs@|jdk	r&t|j���D]}|��qd|_d|_t�|�dSr%)r�rrr�rQr�r	)r�attrr
r
r
rQ�s

zElement.unlinkcCs8|jdkrdSz|j|jWStk
r2YdSXdSr)r�r�ri)rr�r
r
r
�getAttribute�s
zElement.getAttributecCs<|jdkrdSz|j||fjWStk
r6YdSXdSr)r�r�rir�r
r
r
�getAttributeNS�s
zElement.getAttributeNScCsV|�|�}|dkr4t|�}||_|j|_|�|�n||jkrR||_|jrRt|�dSr%)�getAttributeNoder�r�rX�setAttributeNoder�rA)rr�r�r	r
r
r
�setAttribute�s

zElement.setAttributecCs�t|�\}}|�||�}|dkrHt||||�}||_|j|_|�|�n4||jkrf||_|jrft|�|j|kr|||_||_	dSr%)
�_nssplit�getAttributeNodeNSr�r�rXr
r�rArr�)rr~�
qualifiedNamer�r�	localnamer	r
r
r
�setAttributeNS�s

zElement.setAttributeNScCs|jdkrdS|j�|�Sr%r�)r�attrnamer
r
r
r�s
zElement.getAttributeNodecCs|jdkrdS|j�||f�Sr%)r�r�r�r
r
r
rs
zElement.getAttributeNodeNScCs�|jd|fkrtj�d��|��|j�|jd�}|dk	rD|�|�|j	�|j
|jfd�}|dk	rt||k	rt|�|�t||�||k	r�|S||k	r�|SdS)Nzattribute node already owned)
r�r6r7ZInuseAttributeErrrr�r�r��removeAttributeNoder�r~r��_set_attribute_node)rr	Zold1Zold2r
r
r
r
s


zElement.setAttributeNodecCsP|jdkrtj���z|j|}Wntk
r@tj���YnX|�|�dSr%)r�r6r7r?r�rir)rr�r	r
r
r
�removeAttributes

zElement.removeAttributecCsT|jdkrtj���z|j||f}Wntk
rDtj���YnX|�|�dSr%)r�r6r7r?rir)rr~r�r	r
r
r
�removeAttributeNS%s

zElement.removeAttributeNScCs^|dkrtj���z|j|jWntk
r@tj���YnXt|�|��|j|_|Sr%)	r6r7r?r�r�rirArQrXr�r
r
r
r.s
zElement.removeAttributeNodecCs|jdkrdS||jkS�NF�r�r�r
r
r
�hasAttribute>s
zElement.hasAttributecCs|jdkrdS||f|jkSr)r�r�r
r
r
�hasAttributeNSCs
zElement.hasAttributeNScCst||t��Sr%�r�rwr�r
r
r
�getElementsByTagNameHszElement.getElementsByTagNamecCst|||t��Sr%�r�rwr�r
r
r
�getElementsByTagNameNSKs�zElement.getElementsByTagNameNScCsd|jt|�fS)Nz<DOM Element: %s at %#x>)r�r�rr
r
r
rOszElement.__repr__rcCs�|�|d|j�|��}|��D],}|�d|�t|||j�|�d�q$|jr�|�d�t|j�dkr�|jdjt	j
t	jfkr�|jd�|ddd�n4|�|�|jD]}|�|||||�q�|�|�|�d|j|f�n|�d	|�dS)
Nr�z %s="r�r�r1rrz</%s>%sz/>%s)
r�r��_get_attributesr�r�r�r'r�rr	rOr�r)rr$r"�	addindentr#r�Za_namerHr
r
r
rRs*

��


zElement.writexmlcCs|��t|j|j|�Sr%)rr�r�r�rr
r
r
r!mszElement._get_attributescCs|jr
dSdSdSr�rrr
r
r
�
hasAttributesqszElement.hasAttributescCs|�|�}|�|�dSr%)r�setIdAttributeNode)rr��idAttrr
r
r
�setIdAttributeys
zElement.setIdAttributecCs|�||�}|�|�dSr%)rr$)rr~r�r%r
r
r
�setIdAttributeNS}szElement.setIdAttributeNScCsj|dks|�|j�stj���t|�dk	r4tj���|jsfd|_|jd7_|j	j
d7_
t|�dS)NTr1)rdr�r6r7r?�_get_containing_entref�NoModificationAllowedErrr�r�rXr�rA)rr%r
r
r
r$�s

zElement.setIdAttributeNode)rrr).r{r|r}r�r	rSrr�r�r�r�r�r�rOr�r�r5rr�rrarrQr
rrrrrr
ZsetAttributeNodeNSrrrZremoveAttributeNodeNSrrrr rrr!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%)rArr�r�r�r~r�r�)�elementr	r
r
r
r�s
rc@sfeZdZdZdZdZe�ZdZdZ	dd�Z
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�ZdS)�	Childlessz�Mixin that makes childless-ness easy to implement and avoids
    the complexity of the Node methods that deal with children.
    r
NcCsdSr%r
rr
r
r
r,�szChildless._get_firstChildcCsdSr%r
rr
r
r
r/�szChildless._get_lastChildcCstj�|jd��dS)Nz nodes cannot have children�r6r7r8r�r�r
r
r
r<�s�zChildless.appendChildcCsdSrr
rr
r
r
r(�szChildless.hasChildNodescCstj�|jd��dS�Nz nodes do not have childrenr,�rrErFr
r
r
r4�s�zChildless.insertBeforecCstj�|jd��dSr-)r6r7r?r�rNr
r
r
r;�s�zChildless.removeChildcCsdSr%r
rr
r
r
rT�szChildless.normalizecCstj�|jd��dSr-r,�rrErKr
r
r
rL�s�zChildless.replaceChild)r{r|r}r�r�r�Z
EmptyNodeListr'r�r�r,r/r<r(r4r;rTrLr
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��targetrPcCs||_||_dSr%r1)rr2rPr
r
r
r��szProcessingInstruction.__init__cCs|jSr%�rPrr
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�r2rP�rr$r"r"r#r
r
r
r�szProcessingInstruction.writexmlN)rrr)r{r|r}r	r�rr�r�r4r5r�r�r7r8r�rr
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)�_datarXr:rDrCcCs,d|_|_d|_|_d|_t�|�dSr)rXr:rDrCr;r	r�rr
r
r
r��szCharacterData.__init__cCs
t|j�Sr%)r�rPrr
r
r
r��szCharacterData._get_lengthcCs|jSr%�r;rr
r
r
�	_get_data�szCharacterData._get_datacCs
||_dSr%r<�rrPr
r
r
�	_set_data�szCharacterData._set_datacCs6|j}t|�dkrd}nd}d|jj|dd�|fS)N�
z...rz<DOM %s node "%r%s">r)rPr�rr{)rrPZ	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�r6r7�IndexSizeErrr�rP�r�offset�countr
r
r
�
substringData�s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
�
deleteDataszCharacterData.deleteDatacCsr|dkrtj�d��|t|j�kr.tj�d��|dkrBtj�d��|rnd|jd|�||j||d�f|_dS)NrrBrCrDrMrE)rrHrIrKr
r
r
�replaceDatas�zCharacterData.replaceDataN)r{r|r}r�r�r�r�r=r?r�rPr�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	kr~|dkrp|j�
|�n|j�||�|jd|�|_|S)Nrzillegal offset value)r�rPr6r7rFrrXrCr:r'r<r4)rrHZnewText�nextr
r
r
�	splitText1szText.splitTextrcCst|d||j|f�dS)NrM)r�rPr9r
r
r
r@sz
Text.writexmlcCs�|jg}|j}|dk	rB|jtjtjfkrB|�d|j�|j}qqBq|j}|dk	rz|jtjtjfkrz|�|j�|j}qHqzqHd�	|�S)Nrr)
rPrDrr	rOr�rBrCrR�join)rrUr�r
r
r
�_get_wholeTextEszText._get_wholeTextcCs�|j}|j}|dk	r@|jtjtjfkr@|j}|�|�|}qq@q|j}|sT|�|�|dk	r�|jtjtjfkr�|j}|�|�|}qTq�qT|r�||_|SdSdSr%)	r:rDrr	rOr�r;rCrP)rZcontentr�r�rQr
r
r
�replaceWholeTextWs*


zText.replaceWholeTextcCsF|j��rdSt|�}|dkr"dS|j�|�}|dkr:dS|��SdSr)rP�strip�_get_containing_elementrXr��isElementContent)rr�r�r
r
r
�!_get_isWhitespaceInElementContentss
z&Text._get_isWhitespaceInElementContent)rrr)r{r|r}r�r	rOrr�r�rRrrTrUrYr
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}|dk	r&|jtjkr|S|j}qdSr%)r:rr	rS�rHrGr
r
r
rW�srWcCs*|j}|dk	r&|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|jkrtd��|�d||j|f�dS)Nz--z%'--' is not allowed in a comment nodez
%s<!--%s-->%s)rPr>r�r9r
r
r
r�s
zComment.writexmlN)rrr)	r{r|r}r	r�rr�r�rr
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]]>)rP�findr>r�r9r
r
r
r�szCDATASection.writexmlN)rrr)	r{r|r}r�r	r�rr�rr
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`r~r�r�r
r
r
r��s
z-ReadOnlySequentialNamedNodeMap.getNamedItemNScCs4t|t�r|j|�}n
|�|�}|dkr0t|��|Sr%)r�r3r�r�ri)rZ
name_or_tuplerHr
r
r
r��s

z*ReadOnlySequentialNamedNodeMap.__getitem__cCs4|dkrdSz|j|WStk
r.YdSXdSr+)r`r�r�r
r
r
r��sz#ReadOnlySequentialNamedNodeMap.itemcCstj�d��dS�Nz"NamedNodeMap instance is read-only�r6r7r)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,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�
Identifiedz@Mix-in class that supports the publicId and systemId attributes.��publicId�systemIdcCs||_||_dSr%rf)rrgrhr
r
r
�_identified_mixin_init�sz!Identified._identified_mixin_initcCs|jSr%)rgrr
r
r
�
_get_publicId�szIdentified._get_publicIdcCs|jSr%)rhrr
r
r
�
_get_systemId�szIdentified._get_systemIdN)r{r|r}r�r�rirjrkr
r
r
r
re�s
rec@sHeZdZejZdZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dd	d
�ZdS)�DocumentTypeNcCs2t�|_t�|_|r&t|�\}}||_|j|_dSr%)r^�entities�	notationsrr�r�)rrrrr
r
r
r�
szDocumentType.__init__cCs|jSr%)�internalSubsetrr
r
r
�_get_internalSubsetsz DocumentType._get_internalSubsetcCs�|jdkr�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%)rXrlr�r�r6r7�UserDataHandler�NODE_CLONEDrmr`rn�NotationrgrhrRrv�Entity�notationName�actualEncodingrr_)rrY�clonertr��notation�e�entityr
r
r
rZs0

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


zDocumentType.writexml)rrr)r{r|r}r	�DOCUMENT_TYPE_NODErr�r�rgrhror�rprZrr
r
r
r
rlsrlc@sfeZdZdZejZdZdZdZ	dZ
dd�Zdd�Zdd�Z
dd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)rtNcCs$||_||_t�|_|�||�dSr%)r�rurwr'ri)rr�rgrhrxr
r
r
r�GszEntity.__init__cCs|jSr%�rvrr
r
r
�_get_actualEncodingMszEntity._get_actualEncodingcCs|jSr%�rrr
r
r
�
_get_encodingPszEntity._get_encodingcCs|jSr%�r_rr
r
r
�_get_versionSszEntity._get_versioncCstj�d��dS)Nz(cannot append children to an entity node�r6r7r8)rrEr
r
r
r<Vs�zEntity.appendChildcCstj�d��dS)Nz+cannot insert children below an entity noder�r.r
r
r
r4Zs�zEntity.insertBeforecCstj�d��dS)Nz*cannot remove children from an entity noder�rNr
r
r
r;^s�zEntity.removeChildcCstj�d��dS)Nz)cannot replace children of an entity noder�r/r
r
r
rLbs�zEntity.replaceChild)r{r|r}r�r	ZENTITY_NODErr�rvrr_r�r~r�r�r<r4r;rLr
r
r
r
rt>srtc@seZdZejZdZdd�ZdS)rsNcCs||_|�||�dSr%)r�ri)rr�rgrhr
r
r
r�jszNotation.__init__)r{r|r}r	r�rr�r�r
r
r
r
rsfsrsc@sHeZdZddddddddgZd	d
�Zdd�Zd
d�Zdd�Zdd�ZdS)�DOMImplementation)�core�1.0)r��2.0)r�N)r6r�)r6r�)r6N)�ls-loadz3.0)r�NcCs|dkrd}|��|f|jkSr)�lower�	_featuresr]r
r
r
r\zszDOMImplementation.hasFeaturec	Cs�|r|jdk	rtj�d��|��}|dko8|dko8|dk}|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 namer6z$http://www.w3.org/XML/1998/namespacezillegal use of 'xml' prefixz(illegal use of prefix without namespaces)
r:r6r7�WrongDocumentErr�_create_documentZInvalidCharacterErrrr��createElementNSr<rX�doctyper[)	rr~rr�r�Zadd_root_elementrrr*r
r
r
�createDocuments>���
��

z DOMImplementation.createDocumentcCst|�}||_||_|Sr%)rlrgrh)rrrgrhr�r
r
r
�createDocumentType�sz$DOMImplementation.createDocumentTypecCs|�|d�r|SdSdSr%)r\rer
r
r
rf�szDOMImplementation.getInterfacecCst�Sr%)�Documentrr
r
r
r��sz"DOMImplementation._create_documentN)	r{r|r}r�r\r�r�rfr�r
r
r
r
r�os�
-r�c@s\eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�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.

    rcCs
||_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.isElementContentcCsdS)zQReturns true iff this element is declared to have an EMPTY
        content model.Fr
rr
r
r
�isEmpty�szElementInfo.isEmptycCsdS)z7Returns true iff the named attribute is a DTD-style ID.Fr
r�r
r
r
r��szElementInfo.isIdcCsdS)z<Returns true iff the identified attribute is a DTD-style ID.Fr
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�r�rXr�r�r�r�r�r
r
r
r
r��sr�cCs>|jtjkr|j��d|_nt|�r:|jj��d|j_dSr%)rr	r�	_id_cache�clear�_id_search_stackr�rXr�r
r
r
rA�s
rAc@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�rwr'r�r�r�rr
r
r
r�s
zDocument.__init__cCs&|jr|j|jf}n|j}|j�|�Sr%)r~r�r�r�r�)rr*rkr
r
r
r�szDocument._get_elem_infocCs|jSr%r}rr
r
r
r~szDocument._get_actualEncodingcCs|jSr%)r�rr
r
r
�_get_doctypeszDocument._get_doctypecCs|jSr%)�documentURIrr
r
r
�_get_documentURI!szDocument._get_documentURIcCs|jSr%rrr
r
r
r�$szDocument._get_encodingcCs|jSr%)�errorHandlerrr
r
r
�_get_errorHandler'szDocument._get_errorHandlercCs|jSr%)�
standalonerr
r
r
�_get_standalone*szDocument._get_standalonecCs|jSr%)�strictErrorCheckingrr
r
r
�_get_strictErrorChecking-sz!Document._get_strictErrorCheckingcCs|jSr%r�rr
r
r
r�0szDocument._get_versioncCsj|j|jkr(tj�dt|�t|�f��|jdk	r>|j�|�|jtj	kr^|�
�r^tj�d��t�||�S)Nr0z two document elements disallowed)rr5r6r7r8r9r:r;r	rS�_get_documentElementr<r�r
r
r
r<3s�
��zDocument.appendChildcCsVz|j�|�Wntk
r.tj���YnXd|_|_d|_|j	|krRd|_	|Sr%)
r'rMr>r6r7r?rCrDr:�documentElementrNr
r
r
r;Cs
zDocument.removeChildcCs$|jD]}|jtjkr|SqdSr%)r'rr	rSr�r
r
r
r�Os
zDocument._get_documentElementcCs(|jdk	r|j��d|_t�|�dSr%)r�rQr	rr
r
r
rQTs

zDocument.unlinkcCs�|sdS|j�ddd�}|j|_|j|_|j|_|jD]B}t|||�}|j�|�|jt	j
kr`n|jt	jkrr||_||_
q6|�tjjj||�|Sr%)r[r�rr�r_r'rWrRrr	rr|r�r:rvr6r7rqrr)rrYrwr�Z
childcloner
r
r
rZZs&
�zDocument.cloneNodecCst�}||_|Sr%)r�rX)rror
r
r
�createDocumentFragmentoszDocument.createDocumentFragmentcCst|�}||_|Sr%)rrX)rr�ryr
r
r
�
createElementtszDocument.createElementcCs(t|t�std��t�}||_||_|S�Nznode contents must be a string)r�r�r�r�rPrX)rrP�tr
r
r
�createTextNodeys
zDocument.createTextNodecCs(t|t�std��t�}||_||_|Sr�)r�r�r�r\rPrX�rrPrGr
r
r
�createCDATASection�s
zDocument.createCDATASectioncCst|�}||_|Sr%)r[rXr�r
r
r
�
createComment�szDocument.createCommentcCst||�}||_|Sr%)r0rX)rr2rP�pr
r
r
�createProcessingInstruction�s
z$Document.createProcessingInstructioncCst|�}||_d|_|Sr)r�rXr�)rr��ar
r
r
�createAttribute�szDocument.createAttributecCs"t|�\}}t|||�}||_|Sr%)rrrX)rr~rrr�ryr
r
r
r��szDocument.createElementNScCs*t|�\}}t||||�}||_d|_|Sr)rr�rXr�)rr~rrr�r�r
r
r
�createAttributeNS�s
zDocument.createAttributeNScCst||||�}||_|Sr%)rtrX)rr�rgrhruryr
r
r
�_create_entity�szDocument._create_entitycCst|||�}||_|Sr%)rsrX)rr�rgrhr�r
r
r
�_create_notation�szDocument._create_notationcCs�||jkr|j|S|js$|js$dS|j}|dkrB|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|dk	rN�q�qN|S)NcSsg|]}|jtkr|�qSr
)rr@)�.0rVr
r
r
�
<listcomp>�s
�z+Document.getElementById.<locals>.<listcomp>r1)r�r�r�r�r��pop�extendr'r�r�r�r~r�r�r�r�r�r�r�)rr��stack�resultrHr�r	r
r
r
�getElementById�sZ






zDocument.getElementByIdcCst||t��Sr%rr�r
r
r
r�szDocument.getElementsByTagNamecCst|||t��Sr%rr�r
r
r
r �s�zDocument.getElementsByTagNameNScCs|j�||�Sr%)r[r\r]r
r
r
r`�szDocument.isSupportedcCs>|jtjkrtj�d��n|jtjkr2tj�d��t|||�S)Nzcannot import document nodesz!cannot import document type nodes)rr	rr6r7�NotSupportedErrr|rW)rrHrYr
r
r
�
importNode�s
zDocument.importNodercCsJ|dkr|�d|�n|�d||f�|jD]}|�||||�q0dS)Nz<?xml version="1.0" ?>z%<?xml version="1.0" encoding="%s"?>%s)r�r'r)rr$r"r"r#rrHr
r
r
r�s�
zDocument.writexmlcCsJ|j|k	r tj�d||jf��|jtjtjfkr>tj�d��|t	kr�d|kr�|�
dd�\}}|dkr�|tjjkr�tj�d��q�|dkr�|tjjkr�|jtjkr�tj�d��d}|}nd}d}|jtjkr�|j
}|dk	r�|j}|�|�nd}||_||_||_||_|jtjk�r||_n*||_|dk	�rF|�|�|�rF|�|�|S)Nz?cannot rename nodes from other documents;
expected %s,
found %sz8renameNode() only applies to element and attribute nodesr�r1r�zillegal use of 'xmlns' prefixz$illegal use of the 'xmlns' attribute)rXr6r7r�rr	rSr�r�rr�rr�r�r�rrr�r~r�r�r�r
r$)rr�r~r�rr�r*Zis_idr
r
r
�
renameNode	sb
���
��
�
��


zDocument.renameNode)rrrN)=r{r|r}r�r	rSr�r�r|r5r�r[rrr�r�r�r:rDrCrvrr�r_r�r�r�r�r�r�r~r�r�r�r�r�r�r�r<r;r�rQrZr�r�r�r�r�r�r�r�r�r�r�r�rr r`r�rr�r
r
r
r
r��sj�	
:
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)zo
    Clone a node and give it the new owner document.
    Called by Node.cloneNode and Document.importNode
    TrvzCannot clone node %s)9rXrdr6r7rqrrZ
NODE_IMPORTEDrr	rSr�r~r�r�r�rr�rr�r�r'rWr<r2r�rOr�rPr�r�r�r�r2r�r�r�r�r|r[r�r�rgrhrmr`rnrsrRrqrvrtrurvrr_r�r9)
rHrYZnewOwnerDocumentrtrwr	r�rVrGr�rxryrzr
r
r
rWBs�
�


��
��rWcCs,|�dd�}t|�dkr|Sd|dfSdS)Nr�r1�r)r�r�)rZfieldsr
r
r
r�srcCs,|||�}|��\}}|�|�|��|Sr%)ZgetEventZ
expandNoder�)�func�args�kwargsZeventsZtoktypeZrootNoder
r
r
�_do_pulldom_parse�s


r�cCsH|dkr"|s"ddlm}|�|�Sddlm}t|j|f||d��SdS)z3Parse a file into a DOM by filename or file object.Nr��expatbuilder��pulldom)�parser�bufsize)�xml.domr��parser�r�)�filer�r�r�r�r
r
r
r��s

�r�cCsB|dkrddlm}|�|�Sddlm}t|j|fd|i�SdS)z&Parse a file into a DOM from a string.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)7r�rr�r6rrrrZxml.dom.minicompatZxml.dom.xmlbuilderrrr7r	rSr�r@ZdefpropertyrJr�r�r�r�r�r��objectr�Z
AttributeListr�r�rrr+r0r:r�rWr(r[r\r^rerlrtrsr�r�rAr�rWrr�r�r�r�r
r
r
r
�<module>s��v
	y$�
x��)GU��	>�<(	O*P�R




?>