AlkantarClanX12

Your IP : 18.188.113.189


Current Path : /lib64/python2.7/xml/sax/
Upload File :
Current File : //lib64/python2.7/xml/sax/expatreader.pyo

�
{fc@s3dZdZddlTddlmZmZddlmZddlmZmZddlm	Z	ddlm
Z
mZdd	lZej
d
 dkr�ede��n[ydd
lmZWn ek
r�ede��n#Xeed�rede��nddlmZmZmZejZejZydd	lZWnek
r_d�ZnXdd	lZejZ[[dfd��YZdejfd��YZ dej!ejfd��YZ"d�Z#e$dkr/dd	l%Z&e#�Z'e'j(e&j)jj*��e'j+e&j)j,��e'j-d�nd	S(s]
SAX driver for the pyexpat C module.  This driver works with
pyexpat.__version__ == '2.22'.
s0.20i����(t*(tfeature_validationtfeature_namespaces(tfeature_namespace_prefixes(tfeature_external_gestfeature_external_pes(tfeature_string_interning(tproperty_xml_stringtproperty_interning_dictNitjavasexpat not available in Java(texpatsexpat not supportedtParserCreate(t	xmlreadertsaxutilsthandlercCs|S(N((to((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt_mkproxy'st
_ClosedParsercBseZRS((t__name__t
__module__(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR.stExpatLocatorcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s�Locator for use with the ExpatParser class.

    This uses a weak reference to the parser object to avoid creating
    a circular reference between the parser and the content handler.
    cCst|�|_dS(N(Rt_ref(tselftparser((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt__init__9scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber<s	cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
getLineNumberBs	cCs&|j}|dkrdS|jj�S(N(RRt_sourcetgetPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR Hs	cCs&|j}|dkrdS|jj�S(N(RRRtgetSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!Ns	(RRt__doc__RRRR R!(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3s				tExpatParsercBs.eZdZdd%d�Zd�Zd�Zd�Zd	�Zd
�Zd�Z	d�Z
dd
�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�Z d#�Z!RS(&s$SAX driver for the pyexpat C module.iiiicCsetjj||�tj�|_d|_||_d|_d|_	g|_
d|_d|_dS(Nii(
RtIncrementalParserRtInputSourceRRRt_namespacest_lex_handler_propt_parsingt
_entity_stackt
_external_gest
_interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRZs						cCsjtj|�}||_y7|j�|jjt|��tjj	||�Wn|j
��nXdS(s3Parse an XML document from a URL or an InputSource.N(R
tprepare_input_sourceRtresett
_cont_handlertsetDocumentLocatorRRR$tparset
_close_source(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR2gs	

cCsV|j�dk	rR|j�}t|t�r?|jd�}n|jj|�ndS(Nsutf-8(R!Rt
isinstancetunicodetencodeRtSetBase(RR4tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
prepareParserws
cCs-tjj||�|jr)|j�ndS(N(RR$tsetContentHandlerR(t_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR;�s	cCsl|tkr|jS|tkr,|jdk	S|tttfkrEdS|tkrX|j	St
d|��dS(NisFeature '%s' not recognized(RR&RR+RRRRRR*tSAXNotRecognizedException(Rtname((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
getFeature�s
	cCs|jrtd��n|tkr0||_n�|tkrH||_n�|tkr�|rx|jdkr�i|_q�qd|_n||t	kr�|rtd��qnX|t
kr�|rtd��qn4|tkr�|rtd��qntd|��dS(Ns!Cannot set features while parsings!expat does not support validations/expat does not read external parameter entitiess(expat does not report namespace prefixessFeature '%s' not recognized(
R(tSAXNotSupportedExceptionRR&RR*RR+RRRRR=(RR>tstate((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
setFeature�s2	cCs�|tjkr|jS|tkr)|jS|tkr{|jrlt|jd�r]|jj�St	d��q{t
d��nt	d|��dS(NtGetInputContexts=This version of expat does not support getting the XML strings.XML string cannot be returned when not parsingsProperty '%s' not recognized(Rtproperty_lexical_handlerR'RR+RRthasattrRCR=R@(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetProperty�s	
cCs||tjkr1||_|jrx|j�qxnG|tkrI||_n/|tkrhtd|��nt	d|��dS(NsProperty '%s' cannot be setsProperty '%s' not recognized(
RRDR'R(t_reset_lex_handler_propRR+RR@R=(RR>tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsetProperty�s		
cCs�|js,|j�d|_|jj�ny|jj||�WnDtjk
r�}ttj	|j
�||�}|jj|�nXdS(Ni(
R(R/R0t
startDocumentRtParseR
terrortSAXParseExceptiontErrorStringtcodet_err_handlert
fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeed�s	
	cCs_|j}z)|j�}|dk	r1|j�nWd|j�}|dk	rZ|j�nXdS(N(RtgetCharacterStreamRtcloset
getByteStream(RR4tfile((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR3�s	cCs�|js*|jdks*t|jt�r.dSz6|jddd�|jj�d|_d|_Wdd|_|jdk	r�t�}|jj	|_	|jj
|_
||_n|j�XdS(NtRSii(R)RRR5RRVR0tendDocumentR(RRR3(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRX�s
	
		cCs(|jj|j_|jj|j_dS(N(R0tprocessingInstructionRtProcessingInstructionHandlert
characterstCharacterDataHandler(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR<scCs�|j}|j}|dkrNd|_d|_d|_d|_d|_n<|j|_|j	|_|j
|_|j|_|j|_dS(N(
R'RRtCommentHandlertStartCdataSectionHandlertEndCdataSectionHandlertStartDoctypeDeclHandlertEndDoctypeDeclHandlertcommentt
startCDATAtendCDATAtstart_doctype_decltendDTD(RtlexR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRGs						cCsc|jr]tj|jj�dd|j�|_d|j_|j|j_	|j
|j_nBtj|jj�d|j�|_|j|j_	|j
|j_|j�|j|j_|j|j_|j|j_|j|j_d|_|jr|j�n|j|j_y|j|j_Wntk
r9nX|jj tj!�d|_"g|_#dS(Nt tinternii($R&R
RRtgetEncodingR+Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert
start_elementtend_elementR<tunparsed_entity_decltUnparsedEntityDeclHandlert
notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR'RGtexternal_entity_reftExternalEntityRefHandlertskipped_entity_handlertSkippedEntityHandlertAttributeErrortSetParamEntityParsingt*XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONER(R)(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR/s6	
		

	
	cCs|jdkrdS|jjS(N(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR>scCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRCscCs
|jj�S(N(RR (R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR HscCs
|jj�S(N(RR!(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR!KscCs|jj|t|��dS(N(R0tstartElementtAttributesImpl(RR>tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRtOscCs|jj|�dS(N(R0t
endElement(RR>((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRuRscCsL|j�}t|�dkr-d|f}n5t|�dkrV|d|df}nt|�}i}i}x�|j�D]�\}}|j�}t|�}	|	dkr�|}
d|f}nQ|	dkr�d|d|df}
|d|df}n|d}
t|�}|||<|
||<q{W|jj|dt||��dS(Niiis%s:%si(tsplittlenRttupletitemsR0tstartElementNStAttributesNSImpl(RR>R�tpairtnewattrstqnamestanameRHtpartstlengthtqnametapair((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRpUs.

cCsy|j�}t|�dkr-d|f}n5t|�dkrV|d|df}nt|�}|jj|d�dS(Niii(R�R�RR�R0tendElementNS(RR>R�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRrwscCs|jj||�dS(N(R0R](RttargetRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytprocessing_instruction�scCs|jj|�dS(N(R0R_(RRR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcharacter_data�scCs|jj||�dS(N(R0tstartPrefixMapping(Rtprefixturi((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRz�scCs|jj|�dS(N(R0tendPrefixMapping(RR�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR|�scCs|jj|||�dS(N(R'tstartDTD(RR>tsysidtpubidthas_internal_subset((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRi�scCs|jj||||�dS(N(t_dtd_handlertunparsedEntityDecl(RR>R9R�R�t
notation_name((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRv�scCs|jj|||�dS(N(R�tnotationDecl(RR>R9R�R�((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRx�scCs�|js
dS|jj||�}tj||jj�p=d�}|jj|j	|jf�|j	j
|�|_	||_ytjj
||�WndSX|jd\|_	|_|jd=dS(NiR[ii����(R*t_ent_handlert
resolveEntityR
R.RR!R)tappendRtExternalEntityParserCreateRR$R2(RtcontextR9R�R�R4((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR�s 				
cCs'|rd|}n|jj|�dS(Nt%(R0t
skippedEntity(RR>tis_pe((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR��s
ii�("RRR"RR2R:R;R?RBRFRIRVR3RXR<RGR/RRR R!RtRuRpRrR�R�RzR|RiRvRxRR�(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#Ws@
													'							"									cOs
t||�S(N(R#(targstkwargs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt
create_parser�st__main__s:http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml(.R"tversiontxml.sax._exceptionstxml.sax.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRtxml.parsersR
tImportErrorREtxml.saxRR
RR�R�t_weakrefRtweakreftproxyRtLocatorRR$R#R�Rtxml.sax.saxutilstxmltpR;tsaxtXMLGeneratortsetErrorHandlertErrorHandlerR2(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt<module>sL

		

	$�a