AlkantarClanX12

Your IP : 18.119.124.52


Current Path : /opt/alt/python310/lib64/python3.10/xml/dom/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/xml/dom/__pycache__/expatbuilder.cpython-310.pyc

o

6��f���@sdZddlmZmZmZddlmZmZmZddlm	Z	ddl
mZmZddl
mZejZejZejZejjZejjZejjZejjZe��Ze�dd�e�dd	�e�dd
�e�dd�e�dd�e�dd
�e�dd�e�dd�e�dd�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�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�ElementInfo��
_attr_info�_model�tagNameNcCs||_g|_||_dS�N)rrr)�selfr�model�r�;/opt/alt/python310/lib64/python3.10/xml/dom/expatbuilder.py�__init__?s
zElementInfo.__init__cCs|j|j|jfSrr�rrrr�__getstate__D�zElementInfo.__getstate__cCs|\|_|_|_dSrr)r�staterrr�__setstate__GszElementInfo.__setstate__cCsN|jD] }|d|kr#|d}|ddkrtdSt|dSqtjS)N����r�(r)r�
_typeinfo_mapr�_no_type)r�aname�info�trrr�getAttributeTypeJs
�zElementInfo.getAttributeTypecCstjSr)rr&)r�namespaceURI�	localNamerrr�getAttributeTypeNST�zElementInfo.getAttributeTypeNScCs(|jr|jd}|tjjtjjfvSdS�NrF)rrrZ
XML_CTYPE_ANYZXML_CTYPE_MIXED)r�typerrr�isElementContentWs
�zElementInfo.isElementContentcCs|jr|jdtjjkSdSr/)rrrZXML_CTYPE_EMPTYrrrr�isEmpty_szElementInfo.isEmptycCs,|jD]}|d|kr|ddkSqdS)Nr"r#rF)r)rr'r(rrr�isIdes

�zElementInfo.isIdcCs|�||f�Sr)r3)rZeuriZenameZaurir'rrr�isIdNSkszElementInfo.isIdNSr)
�__name__�
__module__�__qualname__�	__slots__rrr!r*r-r1r2r3r4rrrrr<s

rcCs|�||�Sr)�_intern_setdefault)�builder�srrr�_internosr<cCs�d|vsJ�|�d�}|j}t|�dkr/|\}}}|||�}d||f}|||�}|||�}nt|�dkrC|\}}t}|||�}}ntd|��|||�|||fS)N� �z%s:%s�z4Unsupported syntax: spaces in URIs not supported: %r)�splitr9�lenr�
ValueError)r:�name�parts�intern�uri�	localname�prefix�qnamerrr�_parse_ns_namers



rJc@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|durt��}||_|jjdurt|jj�|_nd|_t|_d|_|�	�dSr)
rZOptions�_options�filter�FilterVisibilityController�_filterr�_finish_start_element�_parser�reset)r�optionsrrrr�szExpatBuilder.__init__cCst��S)zCreate a new parser object.)r�ParserCreaterrrr�createParser�szExpatBuilder.createParsercCsF|js |��|_|jjj|_d|j_d|j_d|j_|�|j�|jS)z7Return the parser object, creating a new one if needed.T)	rQrUrE�
setdefaultr9Zbuffer_textZordered_attributesZspecified_attributes�installrrrr�	getParser�s
zExpatBuilder.getParsercCs,t�tdd�|_|j|_|jj|_d|_dS)z6Free all data structures used during DOM construction.NF)�theDOMImplementationZcreateDocumentr�document�curNode�
_elem_info�_cdatarrrrrR�s�

zExpatBuilder.resetcCs�|j|_|j|_|j|_|j|_|jj	r|j
|_|j|_
|jjr$|j|_|jjr5|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�ProcessingInstructionHandlerrLr�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�parserrrrrW�s$
zExpatBuilder.installcCs�|��}d}z%	|�d�}|sn|�|d�|r!|jjr!|�|�d}q|�dd�Wn	ty4Ynw|j}|��d|_|S)zIParse a document from a file object, returning the document
        node.Tr"i@F�N)	rX�read�ParserZ�documentElement�
_setup_subset�ParseEscaperRrQ)r�filerzZfirst_buffer�buffer�docrrr�	parseFile�s(

��zExpatBuilder.parseFilecCsN|��}z
|�|d�|�|�Wn	tyYnw|j}|��d|_|S)z<Parse a document from a string, returning the document node.TN)rXr}rr�rZrRrQ)r�stringrzr�rrr�parseString�s�zExpatBuilder.parseStringcCs2|jjrt�}|�|�|��}||jj_dSdS)z/Load the internal subset if there might be one.N)rZ�doctype�InternalSubsetExtractorr��	getSubset�internalSubset)rr�Z	extractor�subsetrrrr�s
�zExpatBuilder._setup_subsetcCs�|jj�|||�}|j|_t|j|�||j_|jr5|j�|�tkr5d|j_|jj	d=d}d|j
_d|j
_|rR|durCg|j
_g|j_d|j
_d|j
_|j|j
_dSdS�N���)rZ�implementationZcreateDocumentType�
ownerDocumentr	r�rO�
acceptNode�
FILTER_REJECT�
childNodesrQrgrir�_seq�	notationsrlre�end_doctype_decl_handler�EndDoctypeDeclHandler)rZdoctypeName�systemId�publicId�has_internal_subsetr�rrrr^�s(�
�z'ExpatBuilder.start_doctype_decl_handlercCs:|jjr	|j|j_|j|j_|js|jst	|_
dSdSdSr)rLrjrkrQrlrdrer\rOr�_finish_end_elementrrrrr�s


�z%ExpatBuilder.end_doctype_decl_handlercCsH|j�||�}t|j|�|jr |j�|�tkr"|j�|�dSdSdSr)rZZcreateProcessingInstructionr	r[rOr�r��removeChild)r�target�data�noderrrrds
�zExpatBuilder.pi_handlercCs�|jj}|jr$|jr|djtkr|d�|�dS|j�|�}d|_n"|r;|djt	kr;|d}|j
|}||_
dSt��}||_
|j|_
t|j|�dS)Nr�T)r[r�r]�_cdata_continue�nodeType�CDATA_SECTION_NODEZ
appendDatarZZcreateCDATASection�	TEXT_NODEr�r�Textr�r	)rr�r�r��valuerrrrqs"
z)ExpatBuilder.character_data_handler_cdatacCs^|jj}|r|djtkr|d}|j||_dSt��}|j||_|j|_t	|j|�dSr�)
r[r�r�r�r�rr�rZr�r	)rr�r�r�rrrrs&sz#ExpatBuilder.character_data_handlerc
Cs�|rdS|jjs
dS|j�||||�}|dur#|j�|�}	|j�|	�|jjjj�|�|j	r@|j	�
|�tkrB|jjjjd=dSdSdSr�)rLrrZZ_create_entityZcreateTextNoder��appendr�r�rOr�r�)
rZ
entityNameZis_parameter_entityr��baser�r��notationNamer��childrrrrf1s
��z ExpatBuilder.entity_decl_handlercCsR|j�|||�}|jjjj�|�|jr%|j�|�tkr'|jjjjd=dSdSdSr�)	rZZ_create_notationr�r�r�r�rOr��
FILTER_ACCEPT)rr�r�r�r�r�rrrrhCs
�z"ExpatBuilder.notation_decl_handlercCsF|j�|�}t|j|�|jr|j�|�tkr!|j�|�dSdSdSr)rZZ
createCommentr	r[rOr�r�r�)rr�r�rrrrkIs
�zExpatBuilder.comment_handlercCsd|_d|_dS)NTF�r]r�rrrrrmO�
z(ExpatBuilder.start_cdata_section_handlercCsd|_d|_dS)NFr�rrrrroSr�z&ExpatBuilder.end_cdata_section_handlercC�dS�Nr"r)r�contextr�r�r�rrrrtW�z(ExpatBuilder.external_entity_ref_handlercCs2|jdur|jst|_|j|��_|�||�dSr)rOr\rr��start_element_handlerrXra)rrC�
attributesrrrr`Zsz"ExpatBuilder.first_element_handlercCs�|j�|�}t|j|�||_|r8tdt|�d�D]}t�||tdt	�}||d}||_
|j|_t||�q||jj
urE|�|�dSdS)Nrr?r")rZZ
createElementr	r[�rangerAr�Attrrrr�r�r
r~rP)rrCr�r��i�ar�rrrr�`s��z"ExpatBuilder.start_element_handlercCsn|jr5||jjurdS|j�|�}|tkrt|�n|tkr#t|�ndS|j|_	|j�
|�|��dSdSr)rOrZr~�startContainerr��Rejecter�FILTER_SKIP�Skipper�
parentNoder[r��unlink)rr�ZfiltrrrrPqs

�z"ExpatBuilder._finish_start_elementcCs|j}|j|_|�|�dSr)r[r�r�)rrCr[rrrrb�sz ExpatBuilder.end_element_handlercCsd|j�|j�}|r|�||�|jr.||jjurdS|j�|�tkr0|j	�
|�|��dSdSdSr)r\�getr�_handle_white_text_nodesrOrZr~r�r�r[r�r�)rr[r(rrrr��s�z ExpatBuilder._finish_end_elementcCsZ|jjs|��s
dSg}|jD]}|jtkr |j��s |�|�q|D]}|�	|�q#dSr)
rLZwhitespace_in_element_contentr1r�r�r�r��stripr�r�)rr�r(�Lr�rrrr��s�

��z%ExpatBuilder._handle_white_text_nodescCs@|j�|�}|durt||�|j|<dS|jdusJ�||_dSr)r\r�rr)rrCrr(rrrrw�s

z!ExpatBuilder.element_decl_handlerc
CsF|j�|�}|durt|�}||j|<|j�d|dd|d||g�dS�Nr)r\r�rrr�)r�elemrCr0�defaultZrequiredr(rrrrx�s
�z!ExpatBuilder.attlist_decl_handlercCs8||j_||j_|dkr|rd|j_dSd|j_dSdS)NrTF)rZ�version�encoding�
standalone)rr�r�r�rrrrv�s�zExpatBuilder.xml_decl_handlerr) r5r6r7�__doc__rrUrXrRrWr�r�rr^r�rdrqrsrfrhrkrmrortr`r�rPrbr�r�rwrxrvrrrrrK�s<

rKc@s�eZdZdZdZdd�Zdd�Zdd�Zej	e
jeje
j
eje
jeje
jeje
jeje
jeje
jeje
jeje
jeje
jeje
jej e
j!iZ"d	S)
rNzoWrapper around a DOMBuilderFilter which implements the checks
    to make the whatToShow filter attribute work.�rMcCs
||_dSrr�)rrMrrrr�s
z#FilterVisibilityController.__init__cCsP|j|j}|jj|@r&|j�|�}|tkrt�|tvr$tdt	|���|St
S)Nz)startContainer() returned illegal value: )�_nodetype_maskr�rM�
whatToShowr��FILTER_INTERRUPTr��_ALLOWED_FILTER_RETURNSrB�reprr�)rr��mask�valrrrr��s
�z)FilterVisibilityController.startContainercCs�|j|j}|jj|@r>|j�|�}|tkrt�|tkr0|j}|j	dd�D]}|�
|�q&tS|tvr<t
dt|���|StS)Nz%acceptNode() returned illegal value: )r�r�rMr�r�r�r�r�r�r�ZappendChildr�r�rBr�r�)rr�r�r��parentr�rrrr��s 
�z%FilterVisibilityController.acceptNodeN)#r5r6r7r�r8rr�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�rrrrrN�s&
�rNc@�eZdZdZdd�ZdS)�FilterCrutch)�_builder�_level�
_old_start�_old_endcCs6d|_||_|j}|j|_|j|_|j|_|j|_dSr�)	r�r�rQrar�rcr�r�rb)rr:rzrrrrszFilterCrutch.__init__N)r5r6r7r8rrrrrr��r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r�rcCs,t�||�|j}dD]}t||d�qdS)N)rerlrrrnrpru)r�rrQ�setattr)rr:rzrCrrrrs
�zRejecter.__init__cGs|jd|_dSr�)r��r�argsrrrr�rzRejecter.start_element_handlercGsB|jdkr|jj}|j�|�|j|_|j|_dS|jd|_dS�Nrr")r�r�rQrWr�rar�rc)rr�rzrrrrb s
zRejecter.end_element_handlerN)r5r6r7r8rr�rbrrrrr�s
r�c@� eZdZdZdd�Zdd�ZdS)r�rcGs2|jj}|j|�|jj|ur|jd|_dSdSr�)r�r[r�r�)rr�r�rrrr�-s

�zSkipper.start_element_handlercGsF|jdkr|j|jj_|j|jj_d|_dS|jd|_|j|�dSr�)r�r�r�rQrar�rcr�rrrrb3s

zSkipper.end_element_handlerN)r5r6r7r8r�rbrrrrr�*sr�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|_||_t�||�dSr)r�r��originalDocumentr�r�rKr)rr�rSrrrr[s
zFragmentBuilder.__init__cCst�|�d|_dSr)rKrR�fragmentrrrrrRds

zFragmentBuilder.resetcCs|�|���S)zRParse a document fragment from a file object, returning the
        fragment node.)r�r|�rr�rrrr�hszFragmentBuilder.parseFilec	Cs�||_|��}|jj}d}|r+|jp|��}|jr"d|j|jf}n|jr*d|j}nd}|��}t	|||f}z|�
|d�Wn|���|j}|��|S)zMParse a document fragment from a string, returning the
        fragment node.�zPUBLIC "%s" "%s"zSYSTEM "%s"T)
�_sourcerXr�r�r��_getDeclarationsr�r��_getNSattrs�_FRAGMENT_BUILDER_TEMPLATEr}rRr�)	rr�rzr�Zidentr�ZnsattrsrZr�rrrr�ms0
�
�zFragmentBuilder.parseStringcCs
|jjj}d}|r�t|jj�D])}|j�|�}|r|d}d||jf}|jr1d||j|j	f}qd||j	f}qt|j
j�D]C}|j
�|�}|rM|d}d||jf}|jrad||j|j	f}n|j	rld||j	f}nd	||jjf}|j
r~d
||j
f}|d}q?|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.
        r�z
  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�r;r�Znotationr
rrrr��s:
��
z FragmentBuilder._getDeclarationscCr�)Nr�rrrrrr��r�zFragmentBuilder._getNSattrscCs�|tkr<|j}|j}|j�|�}|j|_|j��|_|j|_z|�|j	d�W||_||_d|_	dS||_||_d|_	wt
�|||||�S)NTr�)�$_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDrZr[rQZExternalEntityParserCreater�ZcreateDocumentFragmentr�r}r�rKrt)rr�r�r�r�Zold_documentZold_cur_noderzrrrrt�s&�
�z+FragmentBuilder.external_entity_ref_handlerr)r5r6r7r�rrRr�r�r�r�rtrrrrr�Rs
	$r�c@sBeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Z	d
d�Z	dS)�
Namespacesz7Mix-in class for builders; adds support for namespaces.cCs
g|_dSr)�_ns_ordered_prefixesrrrr�_initNamespaces�s
zNamespaces._initNamespacescCstjdd�}d|_|S)z'Create a new namespace-handling parser.r=)Znamespace_separatorT)rrTZnamespace_prefixesryrrrrU�szNamespaces.createParsercCs$t�||�|jjr|j|_dSdS)z.Insert the namespace-handlers onto the parser.N)rKrWrLZnamespace_declarations�start_namespace_decl_handlerZStartNamespaceDeclHandlerryrrrrW�s
��zNamespaces.installcCs|j�||f�dS)z/Push this namespace declaration on our storage.N)r�r�)rrHrFrrrr��sz'Namespaces.start_namespace_decl_handlercCs�d|vrt||�\}}}}nt}|}d}t}t�||||�}|j|_t|j|�||_|j	r`|j	D](\}}|rEt�
t|d|�t|d�}nt�
dtdt�}||_
|j|_t||�q1|j	dd�=|r�|��|j}	|j}
tdt|�d�D]J}||}||d}
d|vr�t||�\}}}}t�
||||�}||	|<||
||f<nt�
|t|t�}||	|<||
t|f<|j|_|
|_
||_qtdSdS)Nr=�xmlns:�xmlnsrr?r")rJrrrZElementrZr�r	r[r�r�r<rr�r
Z_ensure_attributes�_attrs�_attrsNSr�rAZownerElement)rrCr�rFrGrHrIr�r�r�r�r�r'r�rrrr��sZ����z Namespaces.start_element_handlerTcCs�|j}d|vr$t||�\}}}}|j|kr|j|kr|j|ks#Jd��n|j|ks-Jd��|jtks6Jd��|j|_|�|�dS)Nr=z$element stack messed up! (namespace)z&element stack messed up - bad nodeNamez*element stack messed up - bad namespaceURI)	r[rJr+r,rHr�rr�r�)rrCr[rFrGrHrIrrrrbs 

���zNamespaces.end_element_handlerN)
r5r6r7r�r�rUrWr�r�rbrrrrr��s/r�c@r�)�ExpatBuilderNSz*Document builder that supports namespaces.cC�t�|�|��dSr)rKrRr�rrrrrR)�
zExpatBuilderNS.resetN)r5r6r7r�rRrrrrr�&r�r�c@r�)�FragmentBuilderNSz*Fragment builder that supports namespaces.cCr�r)r�rRr�rrrrrR1r�zFragmentBuilderNS.resetcCs�d}|j}g}|r@t|d�r;|j��D]'\}}||vrq|�|�|r(d|}nd}|r4d|||f}qd||f}q|j}|s	|S)zNReturn string of namespace attributes from this element and
        ancestors.r��_ns_prefix_urir�r�z%s
    %s='%s'z %s='%s')r��hasattrr��itemsr�r�)r�attrsr�r�rHrFZdeclnamerrrr�5s$


�zFragmentBuilderNS._getNSattrsN)r5r6r7r�rRr�rrrrr�.sr�c@seZdZdZdS)r�zEException raised to short-circuit parsing in InternalSubsetExtractor.N)r5r6r7r�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.getSubsetcC�(z	t�||�WdStyYdSwr)rKr�r�r�rrrr�`�
�z!InternalSubsetExtractor.parseFilecCr�r)rKr�r�)rr�rrrr�fr�z#InternalSubsetExtractor.parseStringcCs|j|_|j|_dSr)r^r_r�raryrrrrWlszInternalSubsetExtractor.installcCs.|r|��}g|_|jj|_|j|_dSt��r)rXr�r�ZDefaultHandlerr�r�r�)rrCr�r�r�rzrrrr^ps
z2InternalSubsetExtractor.start_doctype_decl_handlercCs(d�|j��dd��dd�}||_t��)Nr�z
�
�
)�joinr��replacer�)rr;rrrr�zsz0InternalSubsetExtractor.end_doctype_decl_handlercCst��r)r�)rrCr�rrrr�r.z-InternalSubsetExtractor.start_element_handler)r5r6r7r�r�r�r�r�rWr^r�r�rrrrr�Ws
r�TcCsd|rt�}nt�}t|t�r+t|d��}|�|�}Wd�|S1s$wY|S|�|�}|S)z{Parse a document, returning the resulting Document node.

    'file' may be either a file name or an open file object.
    �rbN)r�rK�
isinstance�str�openr�)r��
namespacesr:�fp�resultrrr�parse�s

��
�rcCs|rt�}nt�}|�|�S)zOParse a document from a string, returning the resulting
    Document node.
    )r�rKr�)r�rr:rrrr��s
r�cCsh|rt|�}nt|�}t|t�r-t|d��}|�|�}Wd�|S1s&wY|S|�|�}|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.
    rN)r�r�rrrr�)r�r�rr:rrrrr�
parseFragment�s


��
�rcCs |rt|�}nt|�}|�|�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�rr:rrr�parseFragmentString�s

r	cCs|jrt|�St|�S)z,Create a builder based on an Options object.)rr�rK)rSrrr�makeBuilder�sr
)T)3r�Zxml.domrrrrrrZxml.parsersrZxml.dom.minidomr	r
Zxml.dom.NodeFilterrr�r�r�ZDOMBuilderFilterr�r�r�r�ZgetDOMImplementationrYZTypeInfor%�objectrr<rJrKr�rNr�r�r�r�r�r�r�r�r��	Exceptionr�r�rr�rr	r
rrrr�<module>sh








�3
C:�	��
u_%
,