Wc/cs ddlZddlZddlZddlZddlZddlmZddlmZdZ ifdZ ifdZ ifdZ d Z Gd d ejZGd d ej ZddZdS)N)handler) xmlreadercs^ |jD]\}}|j||}|SN)itemsreplace)ZsZdZkeyvalue )/usr/lib64/python3.12/xml/sax/saxutils.py__dict_replacer s5<ggi"" U IIc5 ! Hcs |jdd}|jdd}|jdd}|rt||}|S)N&&>><<rr dataZentities r escapersO <<W %D <<V $D <<V $DxdH- Kr cs |jdd}|jdd}|rt||}|jddS)Nrrrrr r rrrr unescaper"sK << $D << $DxdH- << %%r cs i|dddd}t||}d|vr#d|vrd|jddz}|Sd |z}|Sd|z}|S) Nz z z ) z z "z'z"%s"z"z'%s')rrrrr quoteattrr0s G(F'vFFFH $ !D d{{ $;;DLLh77D KD=D K} Kr cs8ddl}|jSttjrStt j t jfrSttjrGfdd}|}d|_ nRtj}d|_ j|_ j|_ j|_tj ||ddd S#t$rY(wxYw) Nrcs2eZdZjZfdZdS) _gettextwriter.._wrappercs t|Sr)Zgetattr)selfnameouts r __getattr__z,_gettextwriter.._wrapper.__getattr__ZssD))r N)__name__ __module__ __qualname__Z __class__r)rsr _wrapperrXs7 I * * * * * * *r r#csdSrr$r r  _gettextwriter..]str csdS)NTr$r$r r r%r&bs$r ZxmlcharrefreplacerT)encodingZerrorsZnewlineZ write_through)sysZstdout isinstanceioZ TextIOBasecodecsZ StreamWriterZStreamReaderWriterZ RawIOBaseZcloseZBufferedIOBaseZwritablewriteZseekableZtellZAttributeErrorZ TextIOWrapper)rr'r(r#Zbuffers` r _gettextwriterr-Gs4 { zz#r}}%% #++V-F-FGHH #r||$$ * * * * * * * * *#| ""$&,yy  "llFO((FK   FX#6$(*. 0 00    D s"D DDcsfeZdZddZdZddZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdS) XMLGeneratorN iso-8859-1Fcstjj|t||}|j|_|j |_ig|_|jd|_ g|_ ||_ ||_ d|_ dS)NF)rContentHandler__init__r-r,_writeZflush_flush _ns_contexts_current_context_undeclared_ns_maps _encoding_short_empty_elements_pending_start_element)rrr'Zshort_empty_elementsrr r2zXMLGenerator.__init__rs}''--S(+ii ii D $ 1 1" 5#% !%9"&+###r cs |dr?d|dkr d|dzS|j|d}|r|dz|dzS|dS)Nrz$http://www.w3.org/XML/1998/namespacezxml:rz:)r6)rrprefix r _qnamezXMLGenerator._qname~scE 77 6a@@Q''**473Fv|d1g--Awr csT|jr|jdd|_dSdS)NrFr:r3)r endElementrr _finish_pending_start_elementz*XMLGenerator._finish_pending_start_elements3  & & & KK  */D ' ' ' ' &r csD|jd|jzdS)Nz$ )r3r8r r startDocumentzXMLGenerator.startDocuments, ;' ( ( ( (r cs(|jdSr)r4rArBr endDocumentzXMLGenerator.endDocuments r cs|jj|jj||j|<|jj||fdSr)r5Zappendr6Zcopyr7rr;urir<r startPrefixMappingzXMLGenerator.startPrefixMappingsY   !6!6!;!;!=>>%+c"   '' 6666r csN|jd|_|jd=dS)Nr0)r5r6rr;rr endPrefixMappingzXMLGenerator.endPrefixMappings) $ 1 1" 5   b ! ! !r c s|j|jd|z|jD](\}}|jd|dt|*|jr d|_dS|jddS)Nr =Tr)r@r3rrr9r:)rrattrsrrr startElementzXMLGenerator.startElements **,, C$J"[[] = =MT5 KKKDDD)E*:*:; < < <  % % %*.D ' ' ' KK    r cs~|jr|jdd|_dS|jd|zdSNz/>Fzr>rrrr r?zXMLGenerator.endElementsD  & & & KK  */D ' ' ' KK$ ' ' ' 'r c s|j|jd|j|z|jD]6\}}|r|jd|d|d"|jd|z8g|_|j D]8\}}|jd|j|dt |:|j r d|_dS|jd dS) Nrz xmlns:z="rz xmlns="%s"rJrKTr)r@r3r=r7rrr9r:)rrqnamerLr;rFrs r startElementNSzXMLGenerator.startElementNSs **,, C$++d++,,33 1 1KFCv <=== MC/000#% "[[] J JMT5 KKKDKK$5$5$5y7G7GH I I I  % % %*.D ' ' ' KK    r cs|jr|jdd|_dS|jd|j|zdSrN)r:r3r=rrrPr<r endElementNSzXMLGenerator.endElementNSsN  & & & KK  */D ' ' ' KK$++d"33 4 4 4 4r cs|r[|jt|tst||j}|j t |dSdSr)r@r)strr8r3rrZcontentrr characterszXMLGenerator.characterssS 7  . . 0 0gs++gt~~6 KKw ( ( ( ( 7r cs|rP|jt|tst||j}|j |dSdSr)r@r)rTr8r3rUrr ignorableWhitespacez XMLGenerator.ignorableWhitespacesO 7  . . 0 0gs++gt~~6 KK 7r csZ|j|jd|d|ddS)Nz)r@r3rZtargetrr<r processingInstructionz"XMLGenerator.processingInstructions5 **,, 66644401111r )Nr/F)F)r r!r"r2r=r@rCrDrGrIrMr?rQrSrVrWrYr$r r r.r.ps , , , ,"0000(((777 """((($555)))!!!22222r r.cseZdZ ddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdS) XMLFilterBaseNcsVtjj|||_dSr)r XMLReaderr2_parentrZparentrr r2zXMLFilterBase.__init__s$$$T** r c>|jj|dSr) _err_handlererrorrZ exceptionrr r`zXMLFilterBase.errors  ****r cr^r)r_ fatalErrorrarr rbzXMLFilterBase.fatalErrors $$Y////r cr^r)r_warningrarr rczXMLFilterBase.warnings !!),,,,r cr^r) _cont_handlersetDocumentLocator)rZlocatorrr rez XMLFilterBase.setDocumentLocators --g6666r c<|jjdSr)rdrCrArBr rCzXMLFilterBase.startDocuments ((****r crfr)rdrDrArBr rDzXMLFilterBase.endDocuments &&((((r c@|jj||dSr)rdrGrEr<r rGz XMLFilterBase.startPrefixMappings! --fc::::r cr^r)rdrIrHrr rIzXMLFilterBase.endPrefixMappings ++F3333r crgr)rdrM)rrrLr<r rMzXMLFilterBase.startElement ! ''e4444r cr^r)rdr?rOrr r?zXMLFilterBase.endElements %%d++++r cB|jj|||dSr)rdrQ)rrrPrLrr rQzXMLFilterBase.startElementNSs# ))$u====r crgr)rdrSrRr<r rSzXMLFilterBase.endElementNSrhr cr^r)rdrVrUrr rVzXMLFilterBase.characterss %%g....r cr^r)rdrW)rZcharsrr rWz!XMLFilterBase.ignorableWhitespaces ..u5555r crgr)rdrYrXr<r rYz#XMLFilterBase.processingInstructions! 00>>>>r cr^r)rd skippedEntityrOrr rjzXMLFilterBase.skippedEntity s ((....r crir) _dtd_handler notationDecl)rrpublicIdsystemIdrr rlzXMLFilterBase.notationDecl%s# &&tXx@@@@r csD|jj||||dSr)rkunparsedEntityDecl)rrrmrnZndatas r roz XMLFilterBase.unparsedEntityDecl(s% ,,T8XuMMMMr cs<|jj||Sr)Z _ent_handler resolveEntity)rrmrnr<r rpzXMLFilterBase.resolveEntity-s  ..xBBr cs|jj||jj||jj||jj ||jj |dSr)r\ZsetContentHandlerZsetErrorHandlerZsetEntityResolverZ setDTDHandlerparse)rsourcerr rqzXMLFilterBase.parse2sq &&t,, $$T** &&t,, ""4(( 6""""r cr^r)r\ setLocale)rZlocalerr rszXMLFilterBase.setLocale9s v&&&&r c:|jj|Sr)r\ getFeaturerOrr ruzXMLFilterBase.getFeature<s||&&t,,r crgr)r\ setFeature)rrZstater<r rvzXMLFilterBase.setFeature?s e,,,,r crtr)r\ getPropertyrOrr rwzXMLFilterBase.getPropertyBs||''--r crgr)r\ setProperty)rrrr<r rxzXMLFilterBase.setPropertyEs   u----r cs|jSrr\rArBr getParentzXMLFilterBase.getParentJs ||r cs||_dSrryr]rr setParentzXMLFilterBase.setParentMs  r r)r r!r"r2r`rbrcrerCrDrGrIrMr?rQrSrVrWrYrjrlrorprqrsrurvrwrxrzr{r$r r rZrZs +++000--- 777+++)));;;444555,,,>>>555///666???/// AAANNN CCC ###'''------...... r rZcs t|tjrtj|}t|trt j |}nt|dr|}t j }t|jdtr|j|n|j|t|dr9t|jtr|j|j|j;|j)|j}tj j#tj j%|}tj j'||}tj j)|r!|j|t+|d}nb|jt,j.j1||t,j2j5|j}|j||S)NreadrrZrb)r)osZPathLikeZfspathrTrZ InputSourceZhasattrr}ZsetCharacterStreamZ setByteStreamrZ setSystemIdZgetCharacterStreamZ getByteStreamZ getSystemIdZpathZdirnameZnormpathZjoinZisfileZopenurllibrqZurljoinZrequestZurlopen)rrZbaseZfZsysidZbaseheadZ sysidfilenames r prepare_input_sourcerRsF&"++&&6"&#&&v.  &&( affQi % %  % %a ( ( (   # # 1f  *QVVS"9"9   qvv & &   "*v/C/C/E/M""$77??277#3#3D#9: Xu5 77>>- ( (   } - -]D)AA   v||33D%@ A A&&v'9'9';rsT ('''''''''''      & & & & .'0'0'0Rp2p2p2p2p27))p2p2fkkkkkI''kk^r