Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/xml/dom/pulldom.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@sddlZddlZddlZyejejgZWnek
rYejgZnXdZdZ	dZ
dZdZdZ
dZd	Zd
ejjfd��YZddd
��YZddd��YZdefd��YZdZddd�Zdd�ZdS(i�Nt
START_ELEMENTtEND_ELEMENTtCOMMENTtSTART_DOCUMENTtEND_DOCUMENTtPROCESSING_INSTRUCTIONtIGNORABLE_WHITESPACEt
CHARACTERStPullDOMcBs�eZdZdZdd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�ZRS(cCs�ddlm}||_ddg|_|j|_g|_|jj|_y|jj	|_	Wnt
k
rrnXid|6g|_|jd|_g|_
dS(Ni�(t
XML_NAMESPACEtxml(txml.domR	tdocumentFactorytNonet
firstEventt	lastEventtelementStacktappendtpushtpoptAttributeErrort_ns_contextst_current_contexttpending_events(tselfRR	((s%/sys/lib/python2.7/xml/dom/pulldom.pyt__init__s		
cCs|jd}|jd=|S(Ni�(R(Rtresult((s%/sys/lib/python2.7/xml/dom/pulldom.pyR's

cCs
||_dS(N(t_locator(Rtlocator((s%/sys/lib/python2.7/xml/dom/pulldom.pytsetDocumentLocator,scCsgt|d�sg|_n|jj|p-d|f�|jj|jj��|pYd|j|<dS(Nt_xmlns_attrstxmlns(thasattrRRRRtcopyR
(Rtprefixturi((s%/sys/lib/python2.7/xml/dom/pulldom.pytstartPrefixMapping/s
cCs|jj�|_dS(N(RRR(RR"((s%/sys/lib/python2.7/xml/dom/pulldom.pytendPrefixMapping6scCs;d}t|dd�}|dk	rZx'|D]\}}||j||f<q+Wg|_n|\}}	|r�|dkr�|j|}
|
r�|
d|	}q�|	}n|jr�|jj||�}q|j||�}n0|jr�jj|	�}n|jd|	�}x�j	�D]�}}|\}}
||kr�|
dkrQ|
}n
d|
}|jj
||�}|j|�nt|r�|j|}
|
r�|
d|
}n|
}|jj
||�}|j|�n|jj|
�}|j
|�||_qWt|fdg|jd<|jd|_|j|�dS(Nshttp://www.w3.org/2000/xmlns/Rt:Rsxmlns:i(tgetattrR
t_attrsRRtdocumenttcreateElementNSt
buildDocumentt
createElementtitemstcreateAttributeNStsetAttributeNodeNStcreateAttributetsetAttributeNodetvalueRRR(RtnamettagNametattrst	xmlns_uritxmlns_attrstanameR2R#t	localnameR"tnodeta_urita_localnametqnametattr((s%/sys/lib/python2.7/xml/dom/pulldom.pytstartElementNS9sP
				



cCs3t|j�fdg|jd<|jd|_dS(Ni(RRR
R(RR3R4((s%/sys/lib/python2.7/xml/dom/pulldom.pytendElementNSrscCs�|jr|jj|�}n|jd|�}xB|j�D]4\}}|jj|�}||_|j|�q=Wt|fdg|j	d<|j	d|_	|j
|�dS(Ni(R)R,R+R
R-R0R2R1RRR(RR3R5R:R8R2R>((s%/sys/lib/python2.7/xml/dom/pulldom.pytstartElementvs		cCs3t|j�fdg|jd<|jd|_dS(Ni(RRR
R(RR3((s%/sys/lib/python2.7/xml/dom/pulldom.pyt
endElement�scCsm|jrG|jj|�}t|fdg|jd<|jd|_n"t|fdg}|jj|�dS(Ni(R)t
createCommentRR
RRR(RtsR:tevent((s%/sys/lib/python2.7/xml/dom/pulldom.pytcomment�s	cCss|jrJ|jj||�}t|fdg|jd<|jd|_n%t||fdg}|jj|�dS(Ni(R)tcreateProcessingInstructionRR
RRR(RttargettdataR:RE((s%/sys/lib/python2.7/xml/dom/pulldom.pytprocessingInstruction�s	cCs?|jj|�}t|fdg|jd<|jd|_dS(Ni(R)tcreateTextNodeRR
R(RtcharsR:((s%/sys/lib/python2.7/xml/dom/pulldom.pytignorableWhitespace�scCs?|jj|�}t|fdg|jd<|jd|_dS(Ni(R)RKRR
R(RRLR:((s%/sys/lib/python2.7/xml/dom/pulldom.pyt
characters�scCs7|jdkr3ddl}|jjjj|_ndS(Ni�(RR
txml.dom.minidomtdomtminidomtDocumenttimplementation(RR
((s%/sys/lib/python2.7/xml/dom/pulldom.pyt
startDocument�sc	Cs8|jj||d�}||_t|fdg|jd<|jd|_|j|�x�|jD]�}|ddtkr�|d\}}}|jj	||�}t|f|d<nX|ddt
kr�jj|dd�}t
|f|d<ntd|dd��||jd<||_qaWd|_|j
S(NiisUnknown pending event (RtcreateDocumentR
R)RRRRRRGRRCtAssertionErrort
firstChild(	RR#ttagnameR:tet_RHRItn((s%/sys/lib/python2.7/xml/dom/pulldom.pyR+�s$	


	cCs*t|jfdg|jd<|j�dS(Ni(RR)R
RR(R((s%/sys/lib/python2.7/xml/dom/pulldom.pytendDocument�scCs
d|_dS(s.clear(): Explicitly release parsing structuresN(R
R)(R((s%/sys/lib/python2.7/xml/dom/pulldom.pytclear�sN(t__name__t
__module__R
RR)RRRR$R%R?R@RARBRFRJRMRNRTR+R\R](((s%/sys/lib/python2.7/xml/dom/pulldom.pyRs&					9												tErrorHandlercBs#eZd�Zd�Zd�ZRS(cCs	|GHdS(N((Rt	exception((s%/sys/lib/python2.7/xml/dom/pulldom.pytwarning�scCs
|�dS(N((RRa((s%/sys/lib/python2.7/xml/dom/pulldom.pyterror�scCs
|�dS(N((RRa((s%/sys/lib/python2.7/xml/dom/pulldom.pyt
fatalError�s(R^R_RbRcRd(((s%/sys/lib/python2.7/xml/dom/pulldom.pyR`�s		tDOMEventStreamcBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCsJ||_||_||_t|jd�s<|j|_n|j�dS(Ntfeed(tstreamtparsertbufsizeR t_slurptgetEventtreset(RRgRhRi((s%/sys/lib/python2.7/xml/dom/pulldom.pyR�s			cCs?t�|_|jjtjjjd�|jj|j�dS(Ni(	RtpulldomRht
setFeatureR
tsaxthandlertfeature_namespacestsetContentHandler(R((s%/sys/lib/python2.7/xml/dom/pulldom.pyRl�scCs |j�}|r|St�dS(N(Rkt
IndexError(Rtpostrc((s%/sys/lib/python2.7/xml/dom/pulldom.pyt__getitem__�scCs |j�}|r|St�dS(N(Rkt
StopIteration(RRu((s%/sys/lib/python2.7/xml/dom/pulldom.pytnext�scCs|S(N((R((s%/sys/lib/python2.7/xml/dom/pulldom.pyt__iter__�scCs�|j�}|g}x�|r�|\}}||kr:dS|tkrZ|dj|�n|tkrv|j|�n|tkr�|d=n|j�}qWdS(Ni�(RkRtappendChildRR(RR:REtparentsttokentcur_node((s%/sys/lib/python2.7/xml/dom/pulldom.pyt
expandNode�s		
cCs�|jjds%|jj|j_nxP|jjdsw|jj|j�}|sd|jj�dS|jj	|�q(W|jjdd}|jjdd|jjd<|S(Nii(
RmRRRgtreadRiRhtcloseR
Rf(RtbufRu((s%/sys/lib/python2.7/xml/dom/pulldom.pyRk�s
cCs)|jj|j�|j|_|j�S(s� Fallback replacement for getEvent() using the
            standard SAX2 interface, which means we slurp the
            SAX events into memory (no performance gain, but
            we are compatible to all SAX parsers).
        (RhtparseRgt_emitRk(R((s%/sys/lib/python2.7/xml/dom/pulldom.pyRjscCs6|jjdd}|jjdd|jjd<|S(sn Fallback replacement for getEvent() that emits
            the events that _slurp() read previously.
        ii(RmR(RRu((s%/sys/lib/python2.7/xml/dom/pulldom.pyR�scCs)|jj�|`d|_d|_dS(s+clear(): Explicitly release parsing objectsN(RmR]R
RhRg(R((s%/sys/lib/python2.7/xml/dom/pulldom.pyR] s
	(R^R_RRlRvRxRyR~RkRjR�R](((s%/sys/lib/python2.7/xml/dom/pulldom.pyRe�s								
	tSAX2DOMcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsAtj||||�|jd}|jd}|j|�dS(Ni�i�(RR?RRz(RR3R4R5tcurNodet
parentNode((s%/sys/lib/python2.7/xml/dom/pulldom.pyR?)s

cCs>tj|||�|jd}|jd}|j|�dS(Ni�i�(RRARRz(RR3R5R�R�((s%/sys/lib/python2.7/xml/dom/pulldom.pyRA/s

cCsBtj|||�|jdd}|jd}|j|�dS(Niii�(RRJRRRz(RRHRIR:R�((s%/sys/lib/python2.7/xml/dom/pulldom.pyRJ5s
cCs?tj||�|jdd}|jd}|j|�dS(Niii�(RRMRRRz(RRLR:R�((s%/sys/lib/python2.7/xml/dom/pulldom.pyRM;s
cCs?tj||�|jdd}|jd}|j|�dS(Niii�(RRNRRRz(RRLR:R�((s%/sys/lib/python2.7/xml/dom/pulldom.pyRNAs
(R^R_R?RARJRMRN(((s%/sys/lib/python2.7/xml/dom/pulldom.pyR�'s
				iiicCsd|dkrt}nt|�tkr6t|�}n|}|sTtjj�}nt|||�S(N(	R
tdefault_bufsizettypet_StringTypestopenR
Rotmake_parserRe(tstream_or_stringRhRiRg((s%/sys/lib/python2.7/xml/dom/pulldom.pyR�Js	cCsxyddlm}Wn!tk
r7ddlm}nXt|�}||�}|shtjj�}nt|||�S(Ni�(tStringIO(t	cStringIOR�tImportErrortlenR
RoR�Re(tstringRhR�RiR�((s%/sys/lib/python2.7/xml/dom/pulldom.pytparseStringUs
((i@i�(txml.saxR
txml.sax.handlerttypest
StringTypetUnicodeTypeR�RRRRRRRRRRotContentHandlerRR`ReR�R�R
R�R�(((s%/sys/lib/python2.7/xml/dom/pulldom.pyt<module>s*
�U!

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].