+
     Bim                     0   R t ^ RIHtHtHt ^ RIHtHtHt ^ RIH	t	 ^ RI
HtHt ^ RIHt ]P                  t]P                   t]P"                  t]P$                  P&                  t]P$                  P(                  t]P$                  P*                  t]P$                  P,                  t]P.                  ! 4       tR]P2                  ! RR4      R	]P2                  ! RR
4      R]P2                  ! RR4      R]P2                  ! RR4      R]P2                  ! RR4      R]P2                  ! RR4      R]P2                  ! RR4      R]P2                  ! RR4      R]P2                  ! RR4      /	t ! R R]4      tR tR t ! R R4      t]]]3t  ! R R ]4      t! ! R! R"]4      t" ! R# R$]"4      t# ! R% R&]"4      t$R't%R(]%,          t& ! R) R*]4      t' ! R+ R,4      t( ! R- R.](]4      t) ! R/ R0](]'4      t* ! R1 R2]+4      t, ! R3 R4]4      t-R:R5 lt.R:R6 lt/R:R7 lt0R:R8 lt1R9 t2R# );zFacility 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)
NodeFilterCDATANcdataENUMenumerationENTITYentityENTITIESentitiesIDidIDREFidrefIDREFSidrefsNMTOKENnmtokenNMTOKENSnmtokensc                   ^   a  ] tR t^<t o RtRR ltR tR tR tR t	R t
R tR	 tR
 tRtV tR# )ElementInfoNc                ,    Wn         . V n        W n        R # N)tagName
_attr_info_model)selfr"   models   &&&+/usr/lib/python3.14/xml/dom/expatbuilder.py__init__ElementInfo.__init__?   s        c                H    V P                   V P                  V P                  3# r!   r#   r$   r"   r%   s   &r'   __getstate__ElementInfo.__getstate__D   s    T\\99r*   c                0    Vw  V n         V n        V n        R # r!   r,   )r%   states   &&r'   __setstate__ElementInfo.__setstate__G   s    5:2dlr*   c                    V P                    FM  pV^,          V8X  g   K  VR,          pV^ ,          R8X  d   \        R,          u # \        VR,          ,          u # 	  \        P                  # )   (r   )r#   _typeinfo_mapr   _no_type)r%   anameinfots   &&  r'   getAttributeTypeElementInfo.getAttributeTypeJ   sX    OODAw%HQ43;(00(b22 $ r*   c                "    \         P                  # r!   )r   r9   )r%   namespaceURI	localNames   &&&r'   getAttributeTypeNSElementInfo.getAttributeTypeNST   s    r*   c                    V P                   '       dK   V P                   ^ ,          pV\        P                  P                  \        P                  P                  39  # R#     F)r$   r   r&   XML_CTYPE_ANYXML_CTYPE_MIXED)r%   types   & r'   isElementContentElementInfo.isElementContentW   sH    ;;;;;q>D 9 9 % ; ; = = = r*   c                    V P                   '       d/   V P                   ^ ,          \        P                  P                  8H  # R# rE   )r$   r   r&   XML_CTYPE_EMPTYr-   s   &r'   isEmptyElementInfo.isEmpty_   s+    ;;;;;q>U[[%@%@@@r*   c                d    V P                    F  pV^,          V8X  g   K  VR,          R8H  u # 	  R# )r5   r   Fr7   )r#   )r%   r:   r;   s   && r'   isIdElementInfo.isIde   s0    OODAw%Bx4'' $ r*   c                &    V P                  W434      # r!   )rQ   )r%   eurienameaurir:   s   &&&&&r'   isIdNSElementInfo.isIdNSk   s    yy$''r*   r,   r!   )__name__
__module____qualname____firstlineno__	__slots__r(   r.   r2   r=   rB   rJ   rN   rQ   rW   __static_attributes____classdictcell____classdict__s   @r'   r   r   <   s<     1I
:;  ( (r*   r   c                 $    V P                  W4      # r!   )_intern_setdefault)builderss   &&r'   _internrf   o   s    %%a++r*   c                 ,   VP                  R 4      pV P                  p\        V4      ^8X  d(   Vw  rEpV! Wf4      pV: RV: 2pV! Ww4      pV! WU4      pM6\        V4      ^8X  d   Vw  rE\        pV! WU4      ;ruM\	        RV,          4      hV! WD4      WVV3# ) :z4Unsupported syntax: spaces in URIs not supported: %r)splitrc   lenr   
ValueError)rd   namepartsinternuri	localnameprefixqnames   &&      r'   _parse_ns_namert   r   s    JJsOE''F
5zQ!&'!9-u$90		Uq"988	ORVVWW#Y55r*   c                      a  ] tR t^t o RtR R ltR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t Rt!V t"R# )!ExpatBuilderzLDocument builder that uses Expat to build a ParsedXML.DOM document
instance.Nc                   Vf   \         P                  ! 4       pWn        V P                  P                  e&   \	        V P                  P                  4      V n        MR V n        \        V n        R V n        V P                  4        R # r!   )
r   Options_optionsfilterFilterVisibilityController_filterr   _finish_start_element_parserreset)r%   optionss   &&r'   r(   ExpatBuilder.__init__   sa    ? ((*G==+5dmm6J6JKDLDL *,D&

r*   c                ,    \         P                  ! 4       # )zCreate a new parser object.)r   ParserCreater-   s   &r'   createParserExpatBuilder.createParser   s    !!##r*   c                N   V P                   '       g   V P                  4       V n         V P                   P                  P                  V n        RV P                   n        RV P                   n        RV P                   n        V P                  V P                   4       V P                   # )z7Return the parser object, creating a new one if needed.T)	r~   r   ro   
setdefaultrc   buffer_textordered_attributesspecified_attributesinstallr-   s   &r'   	getParserExpatBuilder.getParser   sq    |||,,.DL&*ll&9&9&D&DD#'+DLL$.2DLL+04DLL-LL&||r*   c                    \         P                  \        RR4      V n        V P                  V n        V P                  P
                  V n        RV n        R# )z6Free all data structures used during DOM construction.NF)theDOMImplementationcreateDocumentr   documentcurNode
_elem_info_cdatar-   s   &r'   r   ExpatBuilder.reset   s>    ,;;T4)}}--22r*   c                   V P                   Vn        V P                  Vn        V P                  Vn        V P                  Vn        V P                  P                  '       d   V P                  Vn        V P                  Vn        V P                  P                  '       d   V P                  Vn        V P                  P"                  '       d5   V P$                  Vn        V P(                  Vn        V P,                  Vn        MV P0                  Vn        V P2                  Vn        V P6                  Vn        V P:                  Vn        V P>                  Vn         R# )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ProcessingInstructionHandlerry   r   entity_decl_handlerEntityDeclHandlernotation_decl_handlerNotationDeclHandlercommentscomment_handlerCommentHandlercdata_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_handlerXmlDeclHandlerelement_decl_handlerElementDeclHandlerattlist_decl_handlerAttlistDeclHandlerr%   parsers   &&r'   r   ExpatBuilder.install   s    *.)H)H&%)%?%?"#'#;#; .2oo+==!!!'+'?'?F$%)%?%?"==!!!$($8$8F!=='''.2.N.NF+,0,J,JF)*.*K*KF'*.*E*EF'*.*J*J' $ 5 5$($=$=!$($=$=!r*   c                   V P                  4       pRp VP                  R4      ;p'       dL   VP                  VR4       V'       d.   V P                  P                  '       d   V P                  V4       RpKd  VP                  RR4       V P                  pV P                  4        RV n        V#   \         d     L2i ; i)zAParse a document from a file object, returning the document
node.TFr*   Ni @  )	r   readParser   documentElement_setup_subsetParseEscaper   r~   )r%   filer   first_bufferbufferdocs   &&    r'   	parseFileExpatBuilder.parseFile   s     !	 IIg..&.VU+DMM$A$A$A&&v.$LLd# mm


  		s   2B/ B/ #'B/ /B=<B=c                    V P                  4       p VP                  VR4       V P                  V4       V P                  pV P                  4        RV n        V#   \         d     L2i ; i)z<Parse a document from a string, returning the document node.TN)r   r   r   r   r   r   r~   )r%   stringr   r   s   &&  r'   parseStringExpatBuilder.parseString   sc    !	LL&v& mm


  		s   #A A('A(c                    V P                   P                  '       dH   \        4       pVP                  V4       VP	                  4       pW0P                   P                  n        R# R# )z/Load the internal subset if there might be one.N)r   doctypeInternalSubsetExtractorr   	getSubsetinternalSubset)r%   r   	extractorsubsets   &&  r'   r   ExpatBuilder._setup_subset   sK    ==   /1I!!&)((*F39MM!!0	 !r*   c                   V P                   P                  P                  WV4      pV P                   Vn        \	        V P                   V4       WPP                   n        V P                  '       dq   V P                  P                  V4      \        8X  dM   R V P                   n        V P                   P                  R R pR V P                  n        R V P                  n        V'       df   Ve#   . VP                  n        . VP                  n        R V P                  n        R V P                  n        V P$                  V P                  n        R # R # N)r   implementationcreateDocumentTypeownerDocumentr	   r   r|   
acceptNodeFILTER_REJECT
childNodesr~   r   r   r   _seq	notationsr   r   end_doctype_decl_handlerEndDoctypeDeclHandler)r%   doctypeNamesystemIdpublicIdhas_internal_subsetr   s   &&&&& r'   r   'ExpatBuilder.start_doctype_decl_handler   s    --..AA8- $dmmW- '<<<DLL33G<M$(DMM!((,G-1DLL*/3DLL,"(*  %)+!!&*.DLL'8<DLL5151N1NDLL. r*   c                   V P                   P                  '       d   V P                  V P                  n        V P
                  V P                  n        V P                  '       g"   V P                  '       g   \        V n
        R # R # R # r!   )ry   r   r   r~   r   r   r   r   r|   r   _finish_end_elementr-   s   &r'   r   %ExpatBuilder.end_doctype_decl_handler  sT    ==!!!*.*>*>DLL'48OO14<<<')D$ $0r*   c                   V P                   P                  W4      p\        V P                  V4       V P                  '       dD   V P                  P                  V4      \        8X  d   V P                  P                  V4       R # R # R # r!   )r   createProcessingInstructionr	   r   r|   r   r   removeChild)r%   targetdatanodes   &&& r'   r   ExpatBuilder.pi_handler	  s]    }}88FdllD)<<<DLL33D9]JLL$$T* K<r*   c                @   V P                   P                  pV P                  '       dl   V P                  '       d7   VR,          P                  \
        8X  d   VR,          P                  V4       R# V P                  P                  V4      pRV n        MtV'       dA   VR,          P                  \        8X  d%   VR,          pVP                  V,           pWCn
        R# \        P                  ! 4       pWn
        V P                  Vn        \        V P                   V4       R# )r5   NTr   )r   r   r   _cdata_continuenodeTypeCDATA_SECTION_NODE
appendDatar   createCDATASection	TEXT_NODEr   r   Textr   r	   )r%   r   r   r   values   &&   r'   r   )ExpatBuilder.character_data_handler_cdata  s    \\,,
;;;&&& n--1CC2))$/==33D9D#'D JrN33y@b>DII$EI<<>DI!%DdllD)r*   c                h   V P                   P                  pV'       d@   VR,          P                  \        8X  d$   VR,          pVP                  V,           Vn        R# \
        P                  ! 4       pVP                  V,           Vn        V P                  Vn        \        V P                   V4       R# r5   Nr   )
r   r   r   r   r   r   r   r   r   r	   )r%   r   r   r   s   &&  r'   r   #ExpatBuilder.character_data_handler#  sv    \\,,
*R.11Y>b>D		D(DI||~II$	!]]dllD)r*   c                >   V'       d   R # V P                   P                  '       g   R # V P                  P                  WWW4      pVe7   V P                  P	                  V4      p	VP
                  P                  V	4       V P                  P                  P                  P                  P                  V4       V P                  '       dT   V P                  P                  V4      \        8X  d.   V P                  P                  P                  P                  R R # R # R # r   )ry   r   r   _create_entitycreateTextNoder   appendr   r   r|   r   r   )
r%   
entityNameis_parameter_entityr   baser   r   notationNamer   childs
   &&&&&&&&  r'   r    ExpatBuilder.entity_decl_handler.  s    }}%%%}}++J,4D MM007EOO""5)&&++2248<<<DLL33D9]J%%..33B7 K<r*   c                z   V P                   P                  WV4      pV P                   P                  P                  P                  P                  V4       V P                  '       dT   V P                  P                  V4      \        8X  d.   V P                   P                  P                  P                  R R# R# R# r   )	r   _create_notationr   r   r   r   r|   r   FILTER_ACCEPT)r%   r  r   r   r   r   s   &&&&& r'   r   "ExpatBuilder.notation_decl_handler@  s    }}--lhO'',,33D9<<<DLL33D9]J%%//44R8 K<r*   c                   V P                   P                  V4      p\        V P                  V4       V P                  '       dD   V P                  P                  V4      \        8X  d   V P                  P                  V4       R # R # R # r!   )r   createCommentr	   r   r|   r   r   r   )r%   r   r   s   && r'   r   ExpatBuilder.comment_handlerF  s]    }}**40dllD)<<<DLL33D9]JLL$$T* K<r*   c                "    R V n         RV n        R# )TFNr   r   r-   s   &r'   r   (ExpatBuilder.start_cdata_section_handlerL  s    $r*   c                "    R V n         R V n        R# )FNr  r-   s   &r'   r   &ExpatBuilder.end_cdata_section_handlerP  s    $r*   c                    ^# )r5    )r%   contextr   r   r   s   &&&&&r'   r   (ExpatBuilder.external_entity_ref_handlerT  s    r*   c                    V P                   f   V P                  '       g   \        V n        V P                  V P                  4       n        V P	                  W4       R # r!   )r|   r   r   r   start_element_handlerr   r   )r%   rm   
attributess   &&&r'   r   "ExpatBuilder.first_element_handlerW  s?    <<')D$/3/I/I,""44r*   c                   V P                   P                  V4      p\        V P                  V4       W0n        V'       dv   \	        ^ \        V4      ^4       F[  p\        P                  ! W$,          \        R\        4      pW$^,           ,          pWen
        V P                   Vn        \        W54       K]  	  W0P                   P                  Jd   V P                  V4       R# R# rF   N)r   createElementr	   r   rangerk   r   Attrr   r   r   r   r
   r   r}   )r%   rm   r  r   iar   s   &&&    r'   r  "ExpatBuilder.start_element_handler]  s    }}**40dllD)1c*oq1LL!%|5"Q3"&--#D, 2 }}444&&t, 5r*   c                r   V P                   '       d   WP                  P                  J d   R # V P                   P                  V4      pV\        8X  d   \        V 4       MV\        8X  d   \        V 4       MR # VP                  V n	        VP                  P                  V4       VP                  4        R # R # r!   )r|   r   r   startContainerr   RejecterFILTER_SKIPSkipper
parentNoder   r   unlink)r%   r   filts   && r'   r}   "ExpatBuilder._finish_start_elementn  s    <<< }}444<<..t4D}$$ ??DLOO''-KKM# r*   c                b    V P                   pVP                  V n         V P                  V4       R # r!   )r   r%  r   )r%   rm   r   s   && r'   r    ExpatBuilder.end_element_handler  s&    ,,))  )r*   c                   V P                   P                  VP                  4      pV'       d   V P                  W4       V P                  '       do   WP
                  P                  J d   R # V P                  P                  V4      \        8X  d.   V P                  P                  V4       VP                  4        R # R # R # r!   )r   getr"   _handle_white_text_nodesr|   r   r   r   r   r   r   r&  )r%   r   r;   s   && r'   r    ExpatBuilder._finish_end_element  s    ""7??3))'8<<<--777||&&w/=@((1  A r*   c                `   V P                   P                  '       g   VP                  4       '       g   R # . pVP                   FM  pVP                  \
        8X  g   K  VP                  P                  4       '       d   K<  VP                  V4       KO  	  V F  pVP                  V4       K  	  R # r!   )
ry   whitespace_in_element_contentrJ   r   r   r   r   stripr   r   )r%   r   r;   Lr  s   &&&  r'   r-  %ExpatBuilder._handle_white_text_nodes  s|    MM777((**
 __E~~*5::3C3C3E3E %
 EU# r*   c                    V P                   P                  V4      pVf   \        W4      V P                   V&   R # W#n        R # r!   )r   r,  r   r$   )r%   rm   r&   r;   s   &&& r'   r   !ExpatBuilder.element_decl_handler  s5    ""4(<$/$<DOOD!  Kr*   c           
         V P                   P                  V4      pVf   \        V4      pW`P                   V&   VP                  P	                  R VR R V^ W5.4       R # r!   )r   r,  r   r#   r   )r%   elemrm   rI   defaultrequiredr;   s   &&&&&& r'   r   !ExpatBuilder.attlist_decl_handler  sV    ""4(<t$D$(OOD!4tWa@	Br*   c                    WP                   n        W P                   n        V^ 8  d/   V'       d   RV P                   n        R# RV P                   n        R# R# )rF   TFN)r   versionencoding
standalone)r%   r<  r=  r>  s   &&&&r'   r   ExpatBuilder.xml_decl_handler  s=     '!)?+/(+0(	 r*   )r   r   r   r|   r   r}   rc   ry   r~   r   r   r!   )#rY   rZ   r[   r\   __doc__r(   r   r   r   r   r   r   r   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'   rv   rv      s     $	>.&:O**+*(	*8$9+%%5-".*
	!$" B1 1r*   rv   c                   N  a  ] tR tRt o RtRtR tR tR t]	P                  ]P                  ]	P                  ]P                  ]	P                  ]P                   ]	P"                  ]P$                  ]	P&                  ]P(                  ]	P*                  ]P,                  ]	P.                  ]P0                  ]	P2                  ]P4                  ]	P6                  ]P8                  ]	P:                  ]P<                  ]	P>                  ]P@                  ]	PB                  ]PD                  /t#Rt$V t%R# )r{   i  zkWrapper around a DOMBuilderFilter which implements the checks
to make the whatToShow filter attribute work.c                    Wn         R # r!   rz   )r%   rz   s   &&r'   r(   #FilterVisibilityController.__init__  s    r*   c                6   V P                   VP                  ,          pV P                  P                  V,          '       dU   V P                  P	                  V4      pV\
        8X  d   \        hV\        9  d   \        R \        V4      ,           4      hV# \        # )z)startContainer() returned illegal value: )_nodetype_maskr   rz   
whatToShowr!  FILTER_INTERRUPTr   _ALLOWED_FILTER_RETURNSrl   reprr  )r%   r   maskvals   &&  r'   r!  )FilterVisibilityController.startContainer  s}    ""4==1;;!!D((++,,T2C&&!!11 ADIMO OJ  r*   c                   V P                   VP                  ,          pV P                  P                  V,          '       d   V P                  P	                  V4      pV\
        8X  d   \        hV\        8X  d>   VP                  pVP                  R ,           F  pVP                  V4       K  	  \        # V\        9  d   \        R\        V4      ,           4      hV# \        # )NNNz%acceptNode() returned illegal value: )rF  r   rz   rG  r   rH  r   r#  r%  r   appendChildr   rI  rl   rJ  r  )r%   r   rK  rL  parentr  s   &&    r'   r   %FilterVisibilityController.acceptNode  s    ""4==1;;!!D((++((.C&&!!k!!__Q//E&&u- 0 %$11 =S	IK KJ  r*   rC  N)&rY   rZ   r[   r\   r@  r]   r(   r!  r   r   ELEMENT_NODEr   SHOW_ELEMENTATTRIBUTE_NODESHOW_ATTRIBUTEr   	SHOW_TEXTr   SHOW_CDATA_SECTIONENTITY_REFERENCE_NODESHOW_ENTITY_REFERENCEENTITY_NODESHOW_ENTITYPROCESSING_INSTRUCTION_NODESHOW_PROCESSING_INSTRUCTIONCOMMENT_NODESHOW_COMMENTDOCUMENT_NODESHOW_DOCUMENTDOCUMENT_TYPE_NODESHOW_DOCUMENT_TYPEDOCUMENT_FRAGMENT_NODESHOW_DOCUMENT_FRAGMENTNOTATION_NODESHOW_NOTATIONrF  r^   r_   r`   s   @r'   r{   r{     s     5 I!!* 	**A*A**C*C**>*>**G*G""**J*J**@*@((**P*P**A*A**B*B**G*G##**K*K**B*B
Nr*   r{   c                   *   a  ] tR tRt o RtR tRtV tR# )FilterCrutchi  c                    ^ V n         Wn        VP                  pVP                  V n        VP
                  V n        V P                  Vn        V P                  Vn        R# r  )	_level_builderr~   r   
_old_startr   _old_endr  r   )r%   rd   r   s   && r'   r(   FilterCrutch.__init__  sM     4400%)%?%?"#'#;#; r*   )rm  rl  ro  rn  N)rm  rl  rn  ro  )rY   rZ   r[   r\   r]   r(   r^   r_   r`   s   @r'   rj  rj    s     >I< <r*   rj  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )r"  i  c                r    \         P                  W4       VP                  pR F  p\        W#R4       K  	  R# )r   N)r   r   r   r   r   r   )rj  r(   r~   setattr)r%   rd   r   rm   s   &&  r'   r(   Rejecter.__init__  s1    d,D F$'r*   c                6    V P                   ^,           V n         R# r5   Nrl  r%   argss   &*r'   r  Rejecter.start_element_handler  s    kkAor*   c                   V P                   ^ 8X  dV   V P                  P                  pV P                  P                  V4       V P                  Vn        V P                  Vn        R# V P                   ^,
          V n         R# r  )rl  rm  r~   r   rn  r   ro  r   )r%   ry  r   s   &* r'   r   Rejecter.end_element_handler  sV    ;;!]]**FMM!!&))-F&'+}}F$++/DKr*   rw  Nr  )
rY   rZ   r[   r\   r]   r(   r  r   r^   r_   r`   s   @r'   r"  r"    s     I
(&* *r*   r"  c                   0   a  ] tR tRt o RtR tR tRtV tR# )r$  i'  c                    V P                   P                  pV P                  ! V!   V P                   P                  VJd   V P                  ^,           V n        R# R# rv  )rm  r   rn  rl  )r%   ry  r   s   &* r'   r  Skipper.start_element_handler*  sC    }}$$==  ,++/DK -r*   c                   V P                   ^ 8X  dT   V P                  V P                  P                  n        V P
                  V P                  P                  n        RV n        R# V P                   ^,
          V n         V P
                  ! V!   R# r  )rl  rn  rm  r~   r   ro  r   rx  s   &*r'   r   Skipper.end_element_handler0  s^    ;;! 9=DMM!!56:mmDMM!!3 DM++/DKMM4 r*   )rm  rl  Nr  )	rY   rZ   r[   r\   r]   r  r   r^   r_   r`   s   @r'   r$  r$  '  s     I*	! 	!r*   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                   R   a  ] tR tRt o RtRR ltR tR tR tR t	R	 t
R
 tRtV tR# )FragmentBuilderiO  zBuilder 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.
Nc                    VP                   \        8X  d   Wn        Wn        MVP                  V n        Wn        \
        P                  W4       R # r!   )r   ra  originalDocumentr  r   rv   r(   )r%   r  r   s   &&&r'   r(   FragmentBuilder.__init__X  s<    },$+!"L$+$9$9D!"Ld,r*   c                >    \         P                  V 4       R V n        R # r!   )rv   r   fragmentr-   s   &r'   r   FragmentBuilder.reseta  s    4 r*   c                @    V P                  VP                  4       4      # )zJParse a document fragment from a file object, returning the
fragment node.)r   r   r%   r   s   &&r'   r   FragmentBuilder.parseFilee  s     		,,r*   c                6   Wn         V P                  4       pV P                  P                  pRpV'       d}   VP                  ;'       g    V P                  4       pVP                  '       d!   RVP                  : RVP                  : R2pM(VP                  '       d   RVP                  ,          pMRpV P                  4       p\        WEV3,          p VP                  VR4       T P                  pT P                  4        T#    T P                  4        h ; i)zEParse a document fragment from a string, returning the
fragment node. zPUBLIC "z" ""zSYSTEM "%s"T)_sourcer   r  r   r   _getDeclarationsr   r   _getNSattrs_FRAGMENT_BUILDER_TEMPLATEr   r   r  )	r%   r   r   r   identr   nsattrsr   r  s	   &&       r'   r   FragmentBuilder.parseStringj  s     !''//++FFt/D/D/FF#,,g.>.>@!!!%(8(88F""$-0HH	LL4( ==

	JJLs   D Dc                   V P                   P                  P                  pRpV'       Ed   \        VP                  P
                  4       F  pVP                  P                  V4      pV'       d
   VR,           pV: RVP                  : 2pVP                  '       d%   V: RVP                  : RVP                  : R2pKx  V: RVP                  : R2pK  	  \        VP                  P
                  4       F  pVP                  P                  V4      pV'       d
   VR,           pV: RVP                  : 2pVP                  '       d$   V: RVP                  : RVP                  : R	2pMEVP                  '       d   V: RVP                  : R	2pMV: R
VP                  P                  : R	2pVP                  '       d   V: RVP                  : 2pVR,           pK  	  V# )zRe-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<!NOTATION z	 PUBLIC "z"
             "z">z	 SYSTEM "z	<!ENTITY r  z "z
 NOTATION >)r  r   r   r  r   lengthitemnodeNamer   r   r   
firstChildr   r  )r%   r   re   r  notationr   s   &     r'   r   FragmentBuilder._getDeclarations  so    ,,,,4477,,334",,11!4F
A)*H,=,=>$$$h//1B1BDA ./0A0ABA 5 7++223 ))..q1F
A'(&//:???foov@A___,-v?A%&(9(9(>(>?A&&&,-v/B/BCAG 4 r*   c                    R # )r  r  r-   s   &r'   r  FragmentBuilder._getNSattrs  s    r*   c                   V\         8X  d   V P                  pV P                  pV P                  P	                  V4      pV P
                  V n        V P                  P                  4       V n        V P                  V n         VP                  V P                  R 4       W`n        WPn        RV n	        R# \        P                  WW#V4      #   Y`n        YPn        RT n	        i ; i)TNr   )$_FRAGMENT_BUILDER_INTERNAL_SYSTEM_IDr   r   r~   ExternalEntityParserCreater  createDocumentFragmentr  r   r  rv   r   )r%   r  r   r   r   old_documentold_cur_noder   s   &&&&&   r'   r   +FragmentBuilder.external_entity_ref_handler  s    ;;  ==L<<L\\<<WEF 11DM MM@@BDM==DL$T\\40+ ,#I;;tx9 9  , ,#s   C	 	C)r  r  r   r   r  r  r!   )rY   rZ   r[   r\   r@  r(   r   r   r   r  r  r   r^   r_   r`   s   @r'   r  r  O  s3     --
8"H9 9r*   r  c                   B   a  ] tR tRt o RtR tR tR tR tR t	RtT tR	# )

Namespacesi  z7Mix-in class for builders; adds support for namespaces.c                    . V n         R # r!   )_ns_ordered_prefixesr-   s   &r'   _initNamespacesNamespaces._initNamespaces  s     %'!r*   c                B    \         P                  ! RR7      pRVn        V# )z'Create a new namespace-handling parser.rh   )namespace_separatorT)r   r   namespace_prefixesr   s   & r'   r   Namespaces.createParser  s    ##<$(!r*   c                    \         P                  W4       V P                  P                  '       d   V P                  Vn        R# R# )z.Insert the namespace-handlers onto the parser.N)rv   r   ry   namespace_declarationsstart_namespace_decl_handlerStartNamespaceDeclHandlerr   s   &&r'   r   Namespaces.install  s6    T*==///11 , 0r*   c                >    V P                   P                  W34       R# )z/Push this namespace declaration on our storage.N)r  r   )r%   rr   rp   s   &&&r'   r  'Namespaces.start_namespace_decl_handler  s    !!((&7r*   c                   R V9   d   \        W4      w  r4rVM\        pTpRp\        p\        P                  ! WcWT4      pV P
                  Vn        \        V P                  V4       Wpn        V P                  '       d   V P                   F  w  rSV'       d0   \        P                  ! \        V RV,           4      \        VR4      pM!\        P                  ! R\        R\        4      pW8n        V P
                  Vn        \        Wx4       K  	  V P                  R V'       d   VP                  4        VP                   p	VP"                  p
\%        ^ \'        V4      ^4       F  pW+,          pW+^,           ,          pR V9   d0   \        W4      w  r4rV\        P                  ! WcWE4      pWV&   WW43&   M/\        P                  ! V\        V\        4      pWV&   W\        V3&   V P
                  Vn        Wn        Wxn        K  	  R# R# )rh   Nxmlns:xmlnsrO  )rt   r   r   r   Elementr   r   r	   r   r  r  rf   r   r   r
   _ensure_attributes_attrs_attrsNSr  rk   ownerElement)r%   rm   r  rp   rq   rr   rs   r   r  r  r  r  r:   r   s   &&&           r'   r   Namespaces.start_element_handler  s   $;,:4,F)CFE!CEI!Fu6=!]]dllD)$$$#88WT8f3D%E%4fgGA  Wo%,l<A"&--#D,  9 ))!,##%[[F}}H1c*oq1""Q3%<4B44O1CFUCA$%5M12c-.UO%*L:A$%5M9:ou56"&--!% 2	 r*   )r  r   N)rY   rZ   r[   r\   r@  r  r   r   r  r  r   r^   r_   r`   s   @r'   r  r    s'     A'
38-&^ r*   r  c                   *   a  ] tR tRt o RtR tRtV tR# )ExpatBuilderNSi#  z*Document builder that supports namespaces.c                P    \         P                  V 4       V P                  4        R # r!   )rv   r   r  r-   s   &r'   r   ExpatBuilderNS.reset&  s    4 r*   r  N)rY   rZ   r[   r\   r@  r   r^   r_   r`   s   @r'   r  r  #  s     4 r*   r  c                   0   a  ] tR tRt o RtR tR tRtV tR# )FragmentBuilderNSi+  z*Fragment builder that supports namespaces.c                P    \         P                  V 4       V P                  4        R # r!   )r  r   r  r-   s   &r'   r   FragmentBuilderNS.reset.  s    d#r*   c                \   RpV P                   p. pV'       d   \        VR4      '       dt   VP                  P                  4        FU  w  rEWC9   d   K  VP	                  V4       V'       d   RV,           pMRpV'       d   V: RV: RV: R2pKJ  RV: RV: R2pKW  	  VP
                  pK  V# )	zFReturn string of namespace attributes from this element and
ancestors.r  _ns_prefix_urir  r  z
    z=''rh   )r  hasattrr  itemsr   r%  )r%   attrsr  r2  rr   rp   declnames   &      r'   r  FragmentBuilderNS._getNSattrs2  s     ,,w 011#*#9#9#?#?#AKF{ HHV$#+f#4#*5:Hc J  /7 < $B ((Gr*   r  N)	rY   rZ   r[   r\   r@  r   r  r^   r_   r`   s   @r'   r  r  +  s     4 r*   r  c                       ] tR tRtRtRtR# )r   iP  zEException raised to short-circuit parsing in InternalSubsetExtractor.r  N)rY   rZ   r[   r\   r@  r^   r  r*   r'   r   r   P  s    Or*   r   c                   R   a  ] tR tRt o RtRtR tR tR tR t	R t
R	 tR
 tRtV tR# )r   iT  zBXML processor which can rip out the internal document type subset.Nc                    V P                   # )z'Return the internal subset as a string.r   r-   s   &r'   r   !InternalSubsetExtractor.getSubsetY  s    {{r*   c                V     \         P                  W4       R #   \         d     R # i ; ir!   )rv   r   r   r  s   &&r'   r   !InternalSubsetExtractor.parseFile]  s'    	""4. 		    ((c                V     \         P                  W4       R #   \         d     R # i ; ir!   )rv   r   r   )r%   r   s   &&r'   r   #InternalSubsetExtractor.parseStringc  s'    	$$T2 		r  c                J    V P                   Vn        V P                  Vn        R # r!   )r   r   r  r   r   s   &&r'   r   InternalSubsetExtractor.installi  s    )-)H)H&%)%?%?"r*   c                    V'       dF   V P                  4       p. V n        V P                  P                  Vn        V P                  Vn        R # \        4       hr!   )r   r   r   DefaultHandlerr   r   r   )r%   rm   r   r   r   r   s   &&&&& r'   r   2InternalSubsetExtractor.start_doctype_decl_handlerm  s@    ^^%FDK$(KK$6$6F!+/+H+HF(-r*   c                    R P                  V P                  4      P                  RR4      P                  RR4      pWn        \        4       h)r  z

)joinr   replacer   )r%   re   s   & r'   r   0InternalSubsetExtractor.end_doctype_decl_handlerw  s;    GGDKK ((6>>tTJmr*   c                    \        4       hr!   )r   )r%   rm   r  s   &&&r'   r  -InternalSubsetExtractor.start_element_handler|  s
    mr*   r  )rY   rZ   r[   r\   r@  r   r   r   r   r   r   r   r  r^   r_   r`   s   @r'   r   r   T  s6     LF@ 
 r*   r   c                   V'       d   \        4       pM
\        4       p\        V \        4      '       d1   \	        V R4      ;_uu_ 4       pVP                  V4      pRRR4       V# VP                  V 4      pV#   + '       g   i     X# ; i)zsParse a document, returning the resulting Document node.

'file' may be either a file name or an open file object.
rbN)r  rv   
isinstancestropenr   )r   
namespacesrd   fpresults   &&   r'   parser    su    
  ".$$&&r*F  M ""4(M	  Ms   A77B	c                ^    V'       d   \        4       pM
\        4       pVP                  V 4      # )zGParse a document from a string, returning the resulting
Document node.
)r  rv   r   )r   r  rd   s   && r'   r   r     s'      ".v&&r*   c                   V'       d   \        V4      pM\        V4      p\        V \        4      '       d1   \	        V R4      ;_uu_ 4       pVP                  V4      pRRR4       V# VP                  V 4      pV#   + '       g   i     X# ; i)zParse 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  rd   r  r  s   &&&   r'   parseFragmentr    sz     #G,!'*$$&&r*F  M ""4(M	  Ms   
A99B
	c                b    V'       d   \        V4      pM\        V4      pVP                  V 4      # )zParse 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  rd   s   &&& r'   parseFragmentStringr    s,    
 #G,!'*v&&r*   c                R    V P                   '       d   \        V 4      # \        V 4      # )z,Create a builder based on an Options object.)r  r  rv   )r   s   &r'   makeBuilderr    s$    g&&G$$r*   )T)3r@  xml.domr   r   r   r   r   r   xml.parsersr   xml.dom.minidomr	   r
   xml.dom.NodeFilterr   r   r   ra  DOMBuilderFilterr  r   r#  rH  getDOMImplementationr   TypeInfor8   objectr   rf   rt   rv   rI  r{   rj  r"  r$  r  r  r  r  r  r  	Exceptionr   r   r  r   r  r  r  r  r*   r'   <module>r     s-  : . - B B  > )NN	,, ""++99++99))55..?? 335    w/
  }5  x0  z2  t,  w/  x0  y1  z2
1(& 1(f,6&y1 y1|	 )-E 7
 7
t
<6 
<*| *8!l !2 ? %* +	+ r9l r9j\. \.~Z "
O "J	) 	)l )X$'(	'%r*   