^Rc@sddlZddlZddlZyejejgZWnek rYejgZnXdZdZ dZ dZ dZ dZ dZd Zd ejjfd YZd dd YZdddYZdefdYZdZdddZddZdS(iNt START_ELEMENTt END_ELEMENTtCOMMENTtSTART_DOCUMENTt END_DOCUMENTtPROCESSING_INSTRUCTIONtIGNORABLE_WHITESPACEt CHARACTERStPullDOMcBseZdZdZddZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZRS(cCsddlm}||_ddg|_|j|_g|_|jj|_y|jj |_ Wnt k rrnXid|6g|_ |j d|_ g|_ dS(Ni(t XML_NAMESPACEtxml(txml.domR tdocumentFactorytNonet firstEventt lastEventt elementStacktappendtpushtpoptAttributeErrort _ns_contextst_current_contexttpending_events(tselfR R ((s%/usr/lib/python2.7/xml/dom/pulldom.pyt__init__s    cCs|jd}|jd=|S(Ni(R(Rtresult((s%/usr/lib/python2.7/xml/dom/pulldom.pyR's  cCs ||_dS(N(t_locator(Rtlocator((s%/usr/lib/python2.7/xml/dom/pulldom.pytsetDocumentLocator,scCsgt|dsg|_n|jj|p-d|f|jj|jj|pYd|j|((s%/usr/lib/python2.7/xml/dom/pulldom.pyt startElementvs  cCs3t|jfdg|jd<|jd|_dS(Ni(RRR R(RR3((s%/usr/lib/python2.7/xml/dom/pulldom.pyt endElementscCsm|jrG|jj|}t|fdg|jd<|jd|_n"t|fdg}|jj|dS(Ni(R)t createCommentRR RRR(RtsR:tevent((s%/usr/lib/python2.7/xml/dom/pulldom.pytcomments  cCss|jrJ|jj||}t|fdg|jd<|jd|_n%t||fdg}|jj|dS(Ni(R)tcreateProcessingInstructionRR RRR(RttargettdataR:RE((s%/usr/lib/python2.7/xml/dom/pulldom.pytprocessingInstructions  cCs?|jj|}t|fdg|jd<|jd|_dS(Ni(R)tcreateTextNodeRR R(RtcharsR:((s%/usr/lib/python2.7/xml/dom/pulldom.pytignorableWhitespacescCs?|jj|}t|fdg|jd<|jd|_dS(Ni(R)RKRR R(RRLR:((s%/usr/lib/python2.7/xml/dom/pulldom.pyt charactersscCs7|jdkr3ddl}|jjjj|_ndS(Ni(R R txml.dom.minidomtdomtminidomtDocumenttimplementation(RR ((s%/usr/lib/python2.7/xml/dom/pulldom.pyt startDocuments c Cs8|jj||d}||_t|fdg|jd<|jd|_|j|x|jD]}|ddtkr|d\}}}|jj ||}t|f|dtj||||jd}|jd}|j|dS(Nii(RRARRz(RR3R5RR((s%/usr/lib/python2.7/xml/dom/pulldom.pyRA/s  cCsBtj||||jdd}|jd}|j|dS(Niii(RRJRRRz(RRHRIR:R((s%/usr/lib/python2.7/xml/dom/pulldom.pyRJ5s cCs?tj|||jdd}|jd}|j|dS(Niii(RRMRRRz(RRLR:R((s%/usr/lib/python2.7/xml/dom/pulldom.pyRM;s cCs?tj|||jdd}|jd}|j|dS(Niii(RRNRRRz(RRLR:R((s%/usr/lib/python2.7/xml/dom/pulldom.pyRNAs (R^R_R?RARJRMRN(((s%/usr/lib/python2.7/xml/dom/pulldom.pyR's     iiicCsd|dkrt}nt|tkr6t|}n|}|sTtjj}nt|||S(N( R tdefault_bufsizettypet _StringTypestopenR Rot make_parserRe(tstream_or_stringRhRiRg((s%/usr/lib/python2.7/xml/dom/pulldom.pyRJs  cCsxyddlm}Wn!tk r7ddlm}nXt|}||}|shtjj}nt|||S(Ni(tStringIO(t cStringIORt ImportErrortlenR RoRRe(tstringRhRRiR((s%/usr/lib/python2.7/xml/dom/pulldom.pyt parseStringUs   ((i@i?(txml.saxR txml.sax.handlerttypest StringTypet UnicodeTypeRRRRRRRRRRRotContentHandlerRR`ReRRR RR(((s%/usr/lib/python2.7/xml/dom/pulldom.pyts*    U!