ó r”þfc@s dZdZddlTddlmZmZddlmZddlmZmZddlm Z ddlm Z m Z dd l Z e j d d kr©ed eƒ‚n[ ydd lmZWn ek râedeƒ‚n#Xeedƒ redeƒ‚nddlmZmZmZejZejZydd lZWnek r_d„ZnXdd lZejZ[[dejfd„ƒYZdej ejfd„ƒYZ!d„Z"e#dkrdd 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 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__6scCs&|j}|jdkrdS|jjS(N(Rt_parsertNonetErrorColumnNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pytgetColumnNumber9s cCs&|j}|jdkrdS|jjS(Ni(RRRtErrorLineNumber(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getLineNumber?s cCs&|j}|dkrdS|jjƒS(N(RRt_sourcet getPublicId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyREs  cCs&|j}|dkrdS|jjƒS(N(RRRt getSystemId(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRKs  (t__name__t __module__t__doc__RRRRR(((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR0s     t ExpatParsercBs%eZdZdd$d„Zd„Zd„Zd„Zd „Zd „Zd „Z d „Z dd „Z d„Z d„Z d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd „Zd!„Zd"„Z RS(%s$SAX driver for the pyexpat C module.iiiicCsetjj||ƒtjƒ|_d|_||_d|_d|_ g|_ d|_ d|_ dS(Nii( R tIncrementalParserRt InputSourceRRRt _namespacest_lex_handler_propt_parsingt _entity_stackt _external_gest _interning(RtnamespaceHandlingtbufsize((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRWs      cCsOtj|ƒ}||_|jƒ|jjt|ƒƒtjj ||ƒdS(s3Parse an XML document from a URL or an InputSource.N( R tprepare_input_sourceRtresett _cont_handlertsetDocumentLocatorRR R#tparse(Rtsource((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR1ds   cCsV|jƒdk rR|jƒ}t|tƒr?|jdƒ}n|jj|ƒndS(Nsutf-8(RRt isinstancetunicodetencodeRtSetBase(RR2tbase((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt prepareParserms  cCs-tjj||ƒ|jr)|jƒndS(N(R R#tsetContentHandlerR't_reset_cont_handler(RR((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR9vs 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|jdkri|_qqd|_n||t kr¨|rtdƒ‚qnX|t krÌ|rtdƒ‚qn4|t krð|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*RRthasattrRAR;R>(RR<((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt getProperty¥s      cCs||tjkr1||_|jrx|jƒqxnG|tkrI||_n/|tkrhtd|ƒ‚nt d|ƒ‚dS(NsProperty '%s' cannot be setsProperty '%s' not recognized( RRBR&R't_reset_lex_handler_propRR*RR>R;(RR<tvalue((s+/usr/lib64/python2.7/xml/sax/expatreader.pyt setProperty·s      cCsŽ|js,|jƒd|_|jjƒny|jj||ƒWnDtjk r‰}ttj |j ƒ||ƒ}|j j |ƒnXdS(Ni( R'R.R/t startDocumentRtParseR terrortSAXParseExceptiont ErrorStringtcodet _err_handlert fatalError(RtdatatisFinaltetexc((s+/usr/lib64/python2.7/xml/sax/expatreader.pytfeedÇs   cCsC|jr dS|jdddƒ|jjƒd|_d|_dS(NtRQii(R(RTR/t endDocumentR'RR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pytcloseØs    cCs(|jj|j_|jj|j_dS(N(R/tprocessingInstructionRtProcessingInstructionHandlert 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.pyREçs            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 R Rt getEncodingR*Rtnamespace_prefixeststart_element_nstStartElementHandlertend_element_nstEndElementHandlert start_elementt end_elementR:tunparsed_entity_decltUnparsedEntityDeclHandlert notation_decltNotationDeclHandlertstart_namespace_decltStartNamespaceDeclHandlertend_namespace_decltEndNamespaceDeclHandlerRt_decl_handler_propR&REtexternal_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.pyRscCs|jdkrdS|jjS(Ni(RRR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR#scCs |jjƒS(N(RR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR(scCs |jjƒS(N(RR(R((s+/usr/lib64/python2.7/xml/sax/expatreader.pyR+scCs|jj|t|ƒƒdS(N(R/t startElementtAttributesImpl(RR<tattrs((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRo/scCs|jj|ƒdS(N(R/t endElement(RR<((s+/usr/lib64/python2.7/xml/sax/expatreader.pyRp2sc 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|ƒ} ||| <| ||         '       "        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.handlerRRRRRRRRtsystplatformtSAXReaderNotAvailableRt xml.parsersR t ImportErrorRCtxml.saxR R RR‚RŠt_weakrefRtweakreftproxytLocatorRR#R"R­Rtxml.sax.saxutilstxmltpR9tsaxt XMLGeneratortsetErrorHandlert ErrorHandlerR1(((s+/usr/lib64/python2.7/xml/sax/expatreader.pytsJ         $ÿD