AlkantarClanX12

Your IP : 3.133.151.90


Current Path : /opt/alt/python36/lib64/python3.6/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/xml/dom/__pycache__/expatbuilder.cpython-36.pyc

3

� f���@sdZddlmZmZmZddlmZmZmZddlm	Z	ddl
mZmZddl
mZejZejZejZejjZejjZejjZejjZej�Zejdd�ejdd	�ejdd
�ejdd�ejdd�ejdd
�ejdd�ejdd�ejdd�d�	ZGdd�de�Zdd�Zdd�ZGdd�d�ZeeefZ Gdd�de�Z!Gdd�de�Z"Gdd�de"�Z#Gd d!�d!e"�Z$d"Z%d#e%Z&Gd$d%�d%e�Z'Gd&d'�d'�Z(Gd(d)�d)e(e�Z)Gd*d+�d+e(e'�Z*Gd,d-�d-e+�Z,Gd.d/�d/e�Z-d;d1d2�Z.d<d3d4�Z/d=d5d6�Z0d>d7d8�Z1d9d:�Z2dS)?z�Facility to use the Expat parser to load a minidom instance
from a string or file.

This avoids all the overhead of SAX and pulldom to gain performance.
�)�
xmlbuilder�minidom�Node)�EMPTY_NAMESPACE�EMPTY_PREFIX�XMLNS_NAMESPACE)�expat)�
_append_child�_set_attribute_node)�
NodeFilterNZcdata�enumeration�entity�entities�idZidrefZidrefsZnmtokenZnmtokens)	ZCDATA�ENUMZENTITYZENTITIES�IDZIDREFZIDREFSZNMTOKENZNMTOKENSc@sZeZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�ElementInfo�
_attr_info�_model�tagNameNcCs||_g|_||_dS)N)rrr)�selfr�model�r�9/opt/alt/python36/lib64/python3.6/xml/dom/expatbuilder.py�__init__?szElementInfo.__init__cCs|j|j|jfS)N)rrr)rrrr�__getstate__DszElementInfo.__getstate__cCs|\|_|_|_dS)N)rrr)r�staterrr�__setstate__GszElementInfo.__setstate__cCsJxB|jD]8}|d|kr|d}|ddkr4tdSt|dSqWtjS)N��r�(r���r!)r�
_typeinfo_mapr�_no_type)r�aname�info�trrr�getAttributeTypeJszElementInfo.getAttributeTypecCstjS)N)rr#)r�namespaceURI�	localNamerrr�getAttributeTypeNSTszElementInfo.getAttributeTypeNScCs,|jr$|jd}|tjjtjjfkSdSdS)NrF)rrrZ
XML_CTYPE_ANYZXML_CTYPE_MIXED)r�typerrr�isElementContentWs

zElementInfo.isElementContentcCs |jr|jdtjjkSdSdS)NrF)rrrZXML_CTYPE_EMPTY)rrrr�isEmpty_szElementInfo.isEmptycCs,x&|jD]}|d|kr|ddkSqWdS)NrrrFr!)r)rr$r%rrr�isIdeszElementInfo.isIdcCs|j||f�S)N)r.)rZeuriZenameZaurir$rrr�isIdNSkszElementInfo.isIdNS)rrr)N)
�__name__�
__module__�__qualname__�	__slots__rrrr'r*r,r-r.r/rrrrr<s

rcCs|j||�S)N)�_intern_setdefault)�builder�srrr�_internosr7cCs�d|kst�|jd�}|j}t|�dkr^|\}}}|||�}d||f}|||�}|||�}n4t|�dkr�|\}}t}|||�}}ntd|��|||�|||fS)N� �z%s:%srz4Unsupported syntax: spaces in URIs not supported: %r)�AssertionError�splitr4�lenr�
ValueError)r5�name�parts�intern�uri�	localname�prefix�qnamerrr�_parse_ns_namers



rEc@s�eZdZdZd;dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�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)<�ExpatBuilderzPDocument builder that uses Expat to build a ParsedXML.DOM document
    instance.NcCsP|dkrtj�}||_|jjdk	r2t|jj�|_nd|_t|_d|_|j	�dS)N)
rZOptions�_options�filter�FilterVisibilityController�_filterr�_finish_start_element�_parser�reset)r�optionsrrrr�szExpatBuilder.__init__cCstj�S)zCreate a new parser object.)r�ParserCreate)rrrr�createParser�szExpatBuilder.createParsercCsF|js@|j�|_|jjj|_d|j_d|j_d|j_|j|j�|jS)z7Return the parser object, creating a new one if needed.T)	rLrPr@�
setdefaultr4Zbuffer_textZordered_attributesZspecified_attributes�install)rrrr�	getParser�s
zExpatBuilder.getParsercCs,tjtdd�|_|j|_|jj|_d|_dS)z6Free all data structures used during DOM construction.NF)�theDOMImplementationZcreateDocumentr�document�curNode�
_elem_info�_cdata)rrrrrM�s

zExpatBuilder.resetcCs�|j|_|j|_|j|_|j|_|jj	r0|j
|_|j|_
|jjrH|j|_|jjrj|j|_|j|_|j|_n|j|_|j|_|j|_|j|_|j|_ dS)z>Install the callbacks needed to build the DOM into the parser.N)!�start_doctype_decl_handler�StartDoctypeDeclHandler�first_element_handler�StartElementHandler�end_element_handler�EndElementHandler�
pi_handler�ProcessingInstructionHandlerrGr�entity_decl_handler�EntityDeclHandler�notation_decl_handler�NotationDeclHandler�comments�comment_handler�CommentHandlerZcdata_sections�start_cdata_section_handler�StartCdataSectionHandler�end_cdata_section_handler�EndCdataSectionHandler�character_data_handler_cdata�CharacterDataHandler�character_data_handler�external_entity_ref_handler�ExternalEntityRefHandler�xml_decl_handlerZXmlDeclHandler�element_decl_handlerZElementDeclHandler�attlist_decl_handlerZAttlistDeclHandler)r�parserrrrrR�s$
zExpatBuilder.installcCs�|j�}d}yLx:|jd�}|s P|j|d�|rB|jjrB|j|�d}qW|jdd�Wntk
rlYnX|j}|j�d|_|S)	zIParse a document from a file object, returning the document
        node.T�irF�Ni@)	rS�read�ParserU�documentElement�
_setup_subset�ParseEscaperMrL)r�filertZfirst_buffer�buffer�docrrr�	parseFile�s$

zExpatBuilder.parseFilecCsP|j�}y|j|d�|j|�Wntk
r6YnX|j}|j�d|_|S)z<Parse a document from a string, returning the document node.TN)rSrxrzr{rUrMrL)r�stringrtr~rrr�parseString�szExpatBuilder.parseStringcCs.|jjr*t�}|j|�|j�}||jj_dS)z/Load the internal subset if there might be one.N)rU�doctype�InternalSubsetExtractorr��	getSubset�internalSubset)rr}Z	extractor�subsetrrrrz�s

zExpatBuilder._setup_subsetcCs�|jjj|||�}|j|_t|j|�||j_|jrj|jj|�tkrjd|j_|jj	d=d}d|j
_d|j
_|r�|dk	r�g|j
_g|j_d|j
_d|j
_|j|j
_dS)Nr���)rU�implementationZcreateDocumentType�
ownerDocumentr	r�rJ�
acceptNode�
FILTER_REJECT�
childNodesrLrbrdr�_seq�	notationsrgr`�end_doctype_decl_handler�EndDoctypeDeclHandler)rZdoctypeName�systemId�publicId�has_internal_subsetr�rrrrY�s$

z'ExpatBuilder.start_doctype_decl_handlercCs2|jjr|j|j_|j|j_|jp&|js.t	|_
dS)N)rGrerfrLrgr_r`rWrJr�_finish_end_element)rrrrr�s


z%ExpatBuilder.end_doctype_decl_handlercCs@|jj||�}t|j|�|jr<|jj|�tkr<|jj|�dS)N)rUZcreateProcessingInstructionr	rVrJr�r��removeChild)r�target�data�noderrrr_szExpatBuilder.pi_handlercCs�|jj}|jrH|jr4|djtkr4|dj|�dS|jj|�}d|_nD|rv|djt	krv|d}|j
|}||_
dStj�}||_
|j|_
t|j|�dS)NrTr�r�r�r�)rVr�rX�_cdata_continue�nodeType�CDATA_SECTION_NODEZ
appendDatarUZcreateCDATASection�	TEXT_NODEr�r�Textr�r	)rr�r�r��valuerrrrls"
z)ExpatBuilder.character_data_handler_cdatacCs^|jj}|r2|djtkr2|d}|j||_dStj�}|j||_|j|_t	|j|�dS)Nrr�r�)
rVr�r�r�r�rr�rUr�r	)rr�r�r�rrrrn&sz#ExpatBuilder.character_data_handlerc
Cs�|rdS|jjsdS|jj||||�}|dk	rF|jj|�}	|jj|	�|jjjjj|�|j	r||j	j
|�tkr||jjjjd=dS)Nrr�)rGrrUZ_create_entityZcreateTextNoder��appendr�r�rJr�r�)
rZ
entityNameZis_parameter_entityr��baser�r��notationNamer��childrrrra1s
z ExpatBuilder.entity_decl_handlercCsJ|jj|||�}|jjjjj|�|jrF|jj|�tkrF|jjjjd=dS)Nrr�)	rUZ_create_notationr�r�r�r�rJr��
FILTER_ACCEPT)rr�r�r�r�r�rrrrcCsz"ExpatBuilder.notation_decl_handlercCs>|jj|�}t|j|�|jr:|jj|�tkr:|jj|�dS)N)rUZ
createCommentr	rVrJr�r�r�)rr�r�rrrrfIszExpatBuilder.comment_handlercCsd|_d|_dS)NTF)rXr�)rrrrrhOsz(ExpatBuilder.start_cdata_section_handlercCsd|_d|_dS)NF)rXr�)rrrrrjSsz&ExpatBuilder.end_cdata_section_handlercCsdS)Nrr)r�contextr�r�r�rrrroWsz(ExpatBuilder.external_entity_ref_handlercCs4|jdkr|jrt|_|j|j�_|j||�dS)N)rJrWrr��start_element_handlerrSr\)rr>�
attributesrrrr[Zsz"ExpatBuilder.first_element_handlercCs�|jj|�}t|j|�||_|rtxPtdt|�d�D]<}tj||tdt	�}||d}||_
|j|_t||�q4W||jj
k	r�|j|�dS)Nrrr)rUZ
createElementr	rV�ranger<r�Attrrrr�r�r
ryrK)rr>r�r��i�ar�rrrr�`sz"ExpatBuilder.start_element_handlercCsj|jrf||jjkrdS|jj|�}|tkr4t|�n|tkrFt|�ndS|j|_	|jj
|�|j�dS)N)rJrUry�startContainerr��Rejecter�FILTER_SKIP�Skipper�
parentNoderVr��unlink)rr�ZfiltrrrrKqs

z"ExpatBuilder._finish_start_elementcCs|j}|j|_|j|�dS)N)rVr�r�)rr>rVrrrr]�sz ExpatBuilder.end_element_handlercCs\|jj|j�}|r|j||�|jrX||jjkr4dS|jj|�tkrX|j	j
|�|j�dS)N)rW�getr�_handle_white_text_nodesrJrUryr�r�rVr�r�)rrVr%rrrr��sz ExpatBuilder._finish_end_elementcCsf|jjs|j�rdSg}x.|jD]$}|jtkr"|jj�r"|j|�q"Wx|D]}|j	|�qPWdS)N)
rGZwhitespace_in_element_contentr,r�r�r�r��stripr�r�)rr�r%�Lr�rrrr��s

z%ExpatBuilder._handle_white_text_nodescCs>|jj|�}|dkr&t||�|j|<n|jdks4t�||_dS)N)rWr�rrr:)rr>rr%rrrrr�s
z!ExpatBuilder.element_decl_handlerc	CsF|jj|�}|dkr&t|�}||j|<|jjd|dd|d||g�dS)Nr)rWr�rrr�)r�elemr>r+�defaultZrequiredr%rrrrs�s
z!ExpatBuilder.attlist_decl_handlercCs2||j_||j_|dkr.|r&d|j_nd|j_dS)NrTF)rU�version�encoding�
standalone)rr�r�r�rrrrq�s
zExpatBuilder.xml_decl_handler)N) r0r1r2�__doc__rrPrSrMrRrr�rzrYr�r_rlrnrarcrfrhrjror[r�rKr]r�r�rrrsrqrrrrrF�s:

rFc@s�eZdZdZd
Zdd�Zdd�Zdd�Zej	e
jeje
j
eje
jeje
jeje
jeje
jeje
jeje
jeje
jeje
jeje
jej e
j!iZ"d	S)rIzoWrapper around a DOMBuilderFilter which implements the checks
    to make the whatToShow filter attribute work.rHcCs
||_dS)N)rH)rrHrrrr�sz#FilterVisibilityController.__init__cCsT|j|j}|jj|@rL|jj|�}|tkr0t�|tkrHtdt	|���|St
SdS)Nz)startContainer() returned illegal value: )�_nodetype_maskr�rH�
whatToShowr��FILTER_INTERRUPTr{�_ALLOWED_FILTER_RETURNSr=�reprr�)rr��mask�valrrrr��sz)FilterVisibilityController.startContainercCs�|j|j}|jj|@r�|jj|�}|tkr0t�|tkrd|j}x |j	dd�D]}|j
|�qNWtS|tkr|t
dt|���|StSdS)Nz%acceptNode() returned illegal value: )r�r�rHr�r�r�r{r�r�r�ZappendChildr�r�r=r�r�)rr�r�r��parentr�rrrr��sz%FilterVisibilityController.acceptNodeN)rH)#r0r1r2r�r3rr�r�rZELEMENT_NODErZSHOW_ELEMENTZATTRIBUTE_NODEZSHOW_ATTRIBUTEr�Z	SHOW_TEXTr�ZSHOW_CDATA_SECTIONZENTITY_REFERENCE_NODEZSHOW_ENTITY_REFERENCEZENTITY_NODEZSHOW_ENTITYZPROCESSING_INSTRUCTION_NODEZSHOW_PROCESSING_INSTRUCTIONZCOMMENT_NODEZSHOW_COMMENT�
DOCUMENT_NODEZ
SHOW_DOCUMENTZDOCUMENT_TYPE_NODEZSHOW_DOCUMENT_TYPEZDOCUMENT_FRAGMENT_NODEZSHOW_DOCUMENT_FRAGMENTZ
NOTATION_NODEZ
SHOW_NOTATIONr�rrrrrI�s"
rIc@seZdZdZdd�ZdS)	�FilterCrutch�_builder�_level�
_old_start�_old_endcCs6d|_||_|j}|j|_|j|_|j|_|j|_dS)Nr)	r�r�rLr\r�r^r�r�r])rr5rtrrrrszFilterCrutch.__init__N)r�r�r�r�)r0r1r2r3rrrrrr�sr�c@s(eZdZfZdd�Zdd�Zdd�ZdS)r�cCs0tj||�|j}xdD]}t||d�qWdS)Nr`rgrmrirkrp)r`rgrmrirkrp)r�rrL�setattr)rr5rtr>rrrrszRejecter.__init__cGs|jd|_dS)Nr)r�)r�argsrrrr�szRejecter.start_element_handlercGs@|jdkr0|jj}|jj|�|j|_|j|_n|jd|_dS)Nrr)r�r�rLrRr�r\r�r^)rr�rtrrrr] s

zRejecter.end_element_handlerN)r0r1r2r3rr�r]rrrrr�sr�c@s eZdZfZdd�Zdd�ZdS)r�cGs.|jj}|j|�|jj|k	r*|jd|_dS)Nr)r�rVr�r�)rr�r�rrrr�-s
zSkipper.start_element_handlercGsD|jdkr*|j|jj_|j|jj_d|_n|jd|_|j|�dS)Nrr)r�r�r�rLr\r�r^)rr�rrrr]3s
zSkipper.end_element_handlerN)r0r1r2r3r�r]rrrrr�*sr�z8http://xml.python.org/entities/fragment-builder/internalz�<!DOCTYPE wrapper
  %%s [
  <!ENTITY fragment-builder-internal
    SYSTEM "%s">
%%s
]>
<wrapper %%s
>&fragment-builder-internal;</wrapper>c@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�FragmentBuilderz�Builder which constructs document fragments given XML source
    text and a context node.

    The context node is expected to provide information about the
    namespace declarations which are in scope at the start of the
    fragment.
    NcCs6|jtkr||_||_n|j|_||_tj||�dS)N)r�r��originalDocumentr�r�rFr)rr�rNrrrr[s
zFragmentBuilder.__init__cCstj|�d|_dS)N)rFrM�fragment)rrrrrMds
zFragmentBuilder.resetcCs|j|j��S)zRParse a document fragment from a file object, returning the
        fragment node.)r�rw)rr|rrrrhszFragmentBuilder.parseFilec		Cs�||_|j�}|jj}d}|rV|jp*|j�}|jrDd|j|jf}qZ|jrZd|j}nd}|j�}t	|||f}y|j
|d�Wn|j��YnX|j}|j�|S)zMParse a document fragment from a string, returning the
        fragment node.rvzPUBLIC "%s" "%s"zSYSTEM "%s"r)
�_sourcerSr�r�r��_getDeclarationsr�r��_getNSattrs�_FRAGMENT_BUILDER_TEMPLATErxrMr�)	rr�rtr�Zidentr�ZnsattrsrUr�rrrr�ms,zFragmentBuilder.parseStringcCs|jjj}d}|�rxbt|jj�D]R}|jj|�}|r>|d}d||jf}|jrfd||j|j	f}q"d||j	f}q"Wx�t|j
j�D]�}|j
j|�}|r�|d}d||jf}|jr�d||j|j	f}n&|j	r�d||j	f}nd	||jjf}|j
�rd
||j
f}|d}q�W|S)z�Re-create the internal subset from the DocumentType node.

        This is only needed if we don't already have the
        internalSubset as a string.
        rvz
  z%s<!NOTATION %sz!%s PUBLIC "%s"
             "%s">z%s SYSTEM "%s">z
%s<!ENTITY %sz %s PUBLIC "%s"
             "%s"z%s SYSTEM "%s"z%s "%s"z%s NOTATION %s�>)r�r�r�r�r�Zlength�item�nodeNamer�r�rZ
firstChildr�r�)rr�r6r�Znotationr
rrrr��s6
z FragmentBuilder._getDeclarationscCsdS)Nrvr)rrrrr��szFragmentBuilder._getNSattrscCs~|tkrh|j}|j}|jj|�}|j|_|jj�|_|j|_z|j|j	d�Wd||_||_d|_	XdSt
j|||||�SdS)Nrr�)�$_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrUrVrLZExternalEntityParserCreater�ZcreateDocumentFragmentr�rxr�rFro)rr�r�r�r�Zold_documentZold_cur_nodertrrrro�sz+FragmentBuilder.external_entity_ref_handler)N)r0r1r2r�rrMrr�r�r�rorrrrr�Rs
	$r�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�
Namespacesz7Mix-in class for builders; adds support for namespaces.cCs
g|_dS)N)�_ns_ordered_prefixes)rrrr�_initNamespaces�szNamespaces._initNamespacescCstjdd�}d|_|S)z'Create a new namespace-handling parser.r8)Znamespace_separatorT)rrOZnamespace_prefixes)rrtrrrrP�szNamespaces.createParsercCs tj||�|jjr|j|_dS)z.Insert the namespace-handlers onto the parser.N)rFrRrGZnamespace_declarations�start_namespace_decl_handlerZStartNamespaceDeclHandler)rrtrrrrR�szNamespaces.installcCs|jj||f�dS)z/Push this namespace declaration on our storage.N)r�r�)rrCrArrrr��sz'Namespaces.start_namespace_decl_handlercCs�d|krt||�\}}}}nt}|}d}t}tj||||�}|j|_t|j|�||_|j	r�xZ|j	D]P\}}|r�tj
t|d|�t|d�}ntj
dtdt�}||_
|j|_t||�qdW|j	dd�=|�r�|j�|j}	|j}
x�tdt|�d�D]�}||}||d}
d|k�rJt||�\}}}}tj
||||�}||	|<||
||f<n$tj
|t|t�}||	|<||
t|f<|j|_|
|_
||_q�WdS)Nr8zxmlns:�xmlnsrrr)rErrrZElementrUr�r	rVr�r�r7rr�r
Z_ensure_attributes�_attrs�_attrsNSr�r<ZownerElement)rr>r�rArBrCrDr�r�r�r�r�r$r�rrrr��sP
z Namespaces.start_element_handlercCs�|j}d|krHt||�\}}}}|j|kr>|j|kr>|j|ksltd��n$|j|ksZtd��|jtksltd��|j|_|j	|�dS)Nr8z$element stack messed up! (namespace)z&element stack messed up - bad nodeNamez*element stack messed up - bad namespaceURI)
rVrEr(r)rCr:r�rr�r�)rr>rVrArBrCrDrrrr]s

zNamespaces.end_element_handlerN)
r0r1r2r�r�rPrRr�r�r]rrrrr��s5r�c@seZdZdZdd�ZdS)�ExpatBuilderNSz*Document builder that supports namespaces.cCstj|�|j�dS)N)rFrMr�)rrrrrM)s
zExpatBuilderNS.resetN)r0r1r2r�rMrrrrr�&sr�c@s eZdZdZdd�Zdd�ZdS)�FragmentBuilderNSz*Fragment builder that supports namespaces.cCstj|�|j�dS)N)r�rMr�)rrrrrM1s
zFragmentBuilderNS.resetcCs�d}|j}g}xv|r�t|d�r|x\|jj�D]N\}}||kr<q*|j|�|rTd|}nd}|rld|||f}q*d||f}q*W|j}qW|S)zNReturn string of namespace attributes from this element and
        ancestors.rv�_ns_prefix_urizxmlns:r�z%s
    %s='%s'z %s='%s')r��hasattrr��itemsr�r�)r�attrsr�r�rCrAZdeclnamerrrr�5s"



zFragmentBuilderNS._getNSattrsN)r0r1r2r�rMr�rrrrr�.sr�c@seZdZdZdS)r{zEException raised to short-circuit parsing in InternalSubsetExtractor.N)r0r1r2r�rrrrr{Ssr{c@sLeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)r�zBXML processor which can rip out the internal document type subset.NcCs|jS)z'Return the internal subset as a string.)r�)rrrrr�\sz!InternalSubsetExtractor.getSubsetcCs*ytj||�Wntk
r$YnXdS)N)rFrr{)rr|rrrr`sz!InternalSubsetExtractor.parseFilecCs*ytj||�Wntk
r$YnXdS)N)rFr�r{)rr�rrrr�fsz#InternalSubsetExtractor.parseStringcCs|j|_|j|_dS)N)rYrZr�r\)rrtrrrrRlszInternalSubsetExtractor.installcCs0|r&|j�}g|_|jj|_|j|_nt��dS)N)rSr�r�ZDefaultHandlerr�r�r{)rr>r�r�r�rtrrrrYps

z2InternalSubsetExtractor.start_doctype_decl_handlercCs,dj|j�jdd�jdd�}||_t��dS)Nrvz
�
�
)�joinr��replacer{)rr6rrrr�zsz0InternalSubsetExtractor.end_doctype_decl_handlercCs
t��dS)N)r{)rr>r�rrrr�sz-InternalSubsetExtractor.start_element_handler)r0r1r2r�r�r�rr�rRrYr�r�rrrrr�Ws
r�Tc	CsL|rt�}nt�}t|t�r>t|d��}|j|�}WdQRXn
|j|�}|S)z{Parse a document, returning the resulting Document node.

    'file' may be either a file name or an open file object.
    �rbN)r�rF�
isinstance�str�openr)r|�
namespacesr5�fp�resultrrr�parse�s

r�cCs|rt�}nt�}|j|�S)zOParse a document from a string, returning the resulting
    Document node.
    )r�rFr�)r�r�r5rrrr��sr�c	CsP|rt|�}nt|�}t|t�rBt|d��}|j|�}WdQRXn
|j|�}|S)z�Parse a fragment of a document, given the context from which it
    was originally extracted.  context should be the parent of the
    node(s) which are in the fragment.

    'file' may be either a file name or an open file object.
    r�N)r�r�r�r�r�r)r|r�r�r5r�r�rrr�
parseFragment�s


r�cCs |rt|�}nt|�}|j|�S)z�Parse a fragment of a document from a string, given the context
    from which it was originally extracted.  context should be the
    parent of the node(s) which are in the fragment.
    )r�r�r�)r�r�r�r5rrr�parseFragmentString�s
r�cCs|jrt|�St|�SdS)z,Create a builder based on an Options object.N)r�r�rF)rNrrr�makeBuilder�sr�)T)T)T)T)3r�Zxml.domrrrrrrZxml.parsersrZxml.dom.minidomr	r
Zxml.dom.NodeFilterrr�r�r�ZDOMBuilderFilterr�r�r�r�ZgetDOMImplementationrTZTypeInfor"�objectrr7rErFr�rIr�r�r�r�r�r�r�r�r��	Exceptionr{r�r�r�r�r�r�rrrr�<module>s^







3C
:u_%,