mò &U²Ic@sdZdkZdkZdkZdkZdkZdkZyeieigZ Wne j oeigZ nXydk l Z dZ [ Wnej o dZ nXd„Zhd„Zhd„Zhd„Zd eifd „ƒYZd eifd „ƒYZd d„ZdS(snA library of useful helper classes to the SAX classes, for the convenience of application and driver writers. N(sxmlcharrefreplace_errorstxmlcharrefreplacetstrictcCs3x,|iƒD]\}}|i||ƒ}q W|S(s2Replace substrings of a string using a dictionary.N(tdtitemstkeytvaluetstreplace(RRRR((t-/data/zmath/lib/python2.4/xml/sax/saxutils.pyt__dict_replaces  cCsT|iddƒ}|iddƒ}|iddƒ}|ot||ƒ}n|S(süEscape &, <, and > in a string of data. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. t&s&t>s>t in a string of data, then quote it for use as an attribute value. The " character will be escaped as well, if necessary. You can escape other strings of data by passing a dictionary as the optional entities parameter. The keys and values must all be strings; each key will be replaced with its corresponding value. s s s s s s t"t's"%s"s"s'%s'N(RtcopytupdateRR R(R R((Rt quoteattr<s  (   t XMLGeneratorcBsztZddd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „ZRS(Ns iso-8859-1cCsn|djodk}|i}ntii|ƒ||_hg|_ |i d|_ g|_ ||_ dS(Niÿÿÿÿ(touttNonetsyststdoutthandlertContentHandlert__init__tselft_outt _ns_contextst_current_contextt_undeclared_ns_mapstencodingt _encoding(RRR#R((RRVs      cCsGt|tƒo|ii|ƒn |ii|i|itƒƒdS(N( t isinstancettexttstrRRtwritetencodeR$t_error_handling(RR&((Rt_writeascCs|id|iƒdS(Ns$ (RR+R$(R((Rt startDocumentiscCs@|ii|iiƒƒ||i|<|ii||fƒdS(N(RR tappendR!RtprefixturiR"(RR.R/((RtstartPrefixMappingms cCs|id|_|id=dS(Niÿÿÿÿ(RR R!(RR.((RtendPrefixMappingrscCs\|id|ƒx7|iƒD])\}}|id|t|ƒfƒqW|idƒdS(NR s %s=%sR (RR+tnametattrsRRR(RR2R3R((Rt startElementvs  !cCs|id|ƒdS(Ns(RR+R2(RR2((Rt endElement|scCsã|ddjo|d}n|i|dd|d}|id|ƒx"|iD]}|id|ƒqWWg|_xT|iƒD]F\}}|i|dd|d}|id|t |ƒfƒqˆW|idƒdS(Niit:R s xmlns:%s="%s"s %s=%sR ( R2RRR!R+R"tpairR3RRR(RR2tqnameR3RR7((RtstartElementNSs   !cCsQ|ddjo|d}n|i|dd|d}|id|ƒdS(NiiR6s(R2RRR!R+(RR2R8((Rt endElementNS‘scCs|it|ƒƒdS(N(RR+Rtcontent(RR;((Rt characters˜scCs|i|ƒdS(N(RR+R;(RR;((RtignorableWhitespace›scCs|id||fƒdS(Ns (RR+ttargetR (RR>R ((RtprocessingInstructionžs(t__name__t __module__RRR+R,R0R1R4R5R9R:R<R=R?(((RRTs          t XMLFilterBasecBs tZdZed„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(sYThis class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.cCstii|ƒ||_dS(N(t xmlreadert XMLReaderRRtparentt_parent(RRE((RRªscCs|ii|ƒdS(N(Rt _err_handlerterrort exception(RRI((RRH°scCs|ii|ƒdS(N(RRGt fatalErrorRI(RRI((RRJ³scCs|ii|ƒdS(N(RRGtwarningRI(RRI((RRK¶scCs|ii|ƒdS(N(Rt _cont_handlertsetDocumentLocatortlocator(RRN((RRM»scCs|iiƒdS(N(RRLR,(R((RR,¾scCs|iiƒdS(N(RRLt endDocument(R((RROÁscCs|ii||ƒdS(N(RRLR0R.R/(RR.R/((RR0ÄscCs|ii|ƒdS(N(RRLR1R.(RR.((RR1ÇscCs|ii||ƒdS(N(RRLR4R2R3(RR2R3((RR4ÊscCs|ii|ƒdS(N(RRLR5R2(RR2((RR5ÍscCs|ii|||ƒdS(N(RRLR9R2R8R3(RR2R8R3((RR9ÐscCs|ii||ƒdS(N(RRLR:R2R8(RR2R8((RR:ÓscCs|ii|ƒdS(N(RRLR<R;(RR;((RR<ÖscCs|ii|ƒdS(N(RRLR=tchars(RRP((RR=ÙscCs|ii||ƒdS(N(RRLR?R>R (RR>R ((RR?ÜscCs|ii|ƒdS(N(RRLt skippedEntityR2(RR2((RRQßscCs|ii|||ƒdS(N(Rt _dtd_handlert notationDeclR2tpublicIdtsystemId(RR2RTRU((RRSäscCs|ii||||ƒdS(N(RRRtunparsedEntityDeclR2RTRUtndata(RR2RTRURW((RRVçscCs|ii||ƒS(N(Rt _ent_handlert resolveEntityRTRU(RRTRU((RRYìscCsT|ii|ƒ|ii|ƒ|ii|ƒ|ii|ƒ|ii|ƒdS(N(RRFtsetContentHandlertsetErrorHandlertsetEntityResolvert setDTDHandlertparsetsource(RR_((RR^ñs cCs|ii|ƒdS(N(RRFt setLocaletlocale(RRa((RR`øscCs|ii|ƒS(N(RRFt getFeatureR2(RR2((RRbûscCs|ii||ƒdS(N(RRFt setFeatureR2tstate(RR2Rd((RRcþscCs|ii|ƒS(N(RRFt getPropertyR2(RR2((RRescCs|ii||ƒdS(N(RRFt setPropertyR2R(RR2R((RRfscCs|iS(N(RRF(R((Rt getParent scCs ||_dS(N(RERRF(RRE((Rt setParent s( R@RAt__doc__RRRHRJRKRMR,ROR0R1R4R5R9R:R<R=R?RQRSRVRYR^R`RbRcReRfRgRh(((RRB¢s:                            tcCsEt|ƒtjoti|ƒ}nXt|dƒoG|}tiƒ}|i|ƒt|dƒo|i|i ƒq}n|i ƒdjo±|i ƒ}tiitii|ƒƒ}tii||ƒ}tii|ƒo |i|ƒt|dƒ}n/|iti||ƒƒti|i ƒƒ}|i|ƒn|S(s‚This function takes an InputSource and an optional base URL and returns a fully resolved InputSource object ready for reading.treadR2trbN(ttypeR_t _StringTypesRCt InputSourcethasattrtft setByteStreamt setSystemIdR2t getByteStreamRt getSystemIdtsysidtostpathtdirnametnormpathtbasetbaseheadtjoint sysidfilenametisfiletopenturlparseturljointurllibturlopen(R_R{RvRqR~R|((Rtprepare_input_sources(    (RiRwRRƒttypesRRCt StringTypet UnicodeTypeRntAttributeErrortcodecstxmlcharrefreplace_errorsR*t ImportErrorR RRRRRRDRBR…(RRnRƒRCRR‹RRR…RRR*RwR R†RB((Rt?s($        No