MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/site-packages/_xmlplus/sax/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/site-packages/_xmlplus/sax/saxutils.pyo
m
Cc@s{dZdkZdkZdkZdkZdkZdkZdkZdkZdk	Z	yei
eigZWne
j
oei
gZnXdZhdZhdZhdZdeieieieifdYZdfd	YZd
fdYZdfd
YZdklZdkZdZeedohdZn
hdZdZdeifdYZ de e	i!fdYZ"de fdYZ#de	i$fdYZ%e%Z&dei'fdYZ(ddZ)d fd!YZ*d"fd#YZ+dk	Z	d$e	i,fd%YZ-d&e	i,fd'YZ.d(fd)YZ/dS(*s
A library of useful helper classes to the saxlib classes, for the
convenience of application and driver writers.

$Id: saxutils.py,v 1.35 2004/03/20 07:46:04 fdrake Exp $
NcCs3x,|iD]\}}|i||}q
W|S(s2Replace substrings of a string using a dictionary.N(tdtitemstkeytvaluetstreplace(RRRR((t9/usr/lib/python2.4/site-packages/_xmlplus/sax/saxutils.pyt__dict_replaces

cCsT|idd}|idd}|idd}|ot||}n|S(sEscape &, <, 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&amp;t<s&lt;t>s&gt;N(tdataRtentitiesR(RR((RtescapescCsN|idd}|idd}|ot||}n|iddS(s
Unescape &amp;, &lt;, and &gt; in a string of data.

    You can unescape 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&lt;R	s&gt;R
s&amp;RN(RRRR(RR((Rtunescape&scCs_t||}d|jo5d|jod|idd}q[d|}nd|}|S(sEscape and quote an attribute value.

    Escape &, <, and > 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.
    t"t's"%s"s&quot;s'%s'N(R
RRR(RR((Rt	quoteattr4s



tDefaultHandlercBstZdZRS(sDefault base class for SAX2 event handlers. Implements empty
    methods for all callback methods, which can be overridden by
    application implementors. Replaces the deprecated SAX1 HandlerBase
    class.(t__name__t
__module__t__doc__(((RRKstLocationcBsDtZdZdZdZdZdZdZdZRS(sRepresents a location in an XML entity. Initialized by being passed
    a locator, from which it reads off the current location, which is then
    stored internally.cCs@|i|_|i|_|i|_|i|_	dS(N(
tlocatortgetColumnNumbertselft_Location__colt
getLineNumbert_Location__linetgetPublicIdt_Location__pubidtgetSystemIdt_Location__sysid(RR((Rt__init__YscCs|iS(N(RR(R((RR_scCs|iS(N(RR(R((RRbscCs|iS(N(RR(R((RRescCs|iS(N(RR (R((RRhscCsk|idjo
d}n
|i}|idjo
d}n
|i}d|ip|ipd||fS(Nt?s%s:%s:%ss	<unknown>(RRtNonetlineRtcolR R(RR$R%((Rt__str__ks
	
	(	RRRR!RRRRR&(((RRTs					tErrorPrintercBsDtZdZdeidZdZdZdZdZ	RS(s?A simple class that just prints error messages to standard out.icCs||_||_dS(N(tlevelRt_leveltoutfilet_outfile(RR(R*((RR!}s	cCsA|idjo-|iid|i||ifndS(NisWARNING in %s: %s
(RR)R+twritet_ErrorPrinter__getpost	exceptiont
getMessage(RR.((RtwarningscCsA|idjo-|iid|i||ifndS(NisERROR in %s: %s
(RR)R+R,R-R.R/(RR.((RterrorscCsA|idjo-|iid|i||ifndS(NisFATAL ERROR in %s: %s
(RR)R+R,R-R.R/(RR.((Rt
fatalErrorscCsBt|tio'd|i|i|ifSndSdS(Ns%s:%s:%ss	<unknown>(t
isinstanceR.t_exceptionstSAXParseExceptionRRR(RR.((Rt__getposs'(
RRRtsyststderrR!R0R1R2R-(((RR'zs			tErrorRaisercBs5tZdZddZdZdZdZRS(s<A simple class that just raises the exceptions it is passed.icCs
||_dS(N(R(RR)(RR(((RR!scCs|idjo
|ndS(Ni(RR)R.(RR.((RR1scCs|idjo
|ndS(Ni(RR)R.(RR.((RR2scCs|idjo
|ndS(Ni(RR)R.(RR.((RR0s(RRRR!R1R2R0(((RR9s
		(sAttributesImplcCsti|d}||S(Ni(tcodecstlookuptencodingtwriterclasststream(R>R<R=((Rt_outputwrapperstregister_errorcCs,d|_|it||d|_dS(Ntxmlcharrefreplacetstrict(R>terrorsR,R
ttextR(R>RDR((Rt	writetexts	cCst||}y|i|Wnbtj
oVxQ|D]D}y|i|Wq8tj
o|idt|q8Xq8WnXdS(Nu&#%d;(R
RDRR>R,tUnicodeErrortctord(R>RDRRG((RREscCs|id}|oN|id}||johdd<}d}qphdd<}d}n
h}d}|i|t||||i|dS(NRRs&quot;s&apos;(	RDtcounttcountdoubletcountsingleRtquoteR>R,RE(R>RDRRKRLRJ((Rt	writeattrs



tXMLGeneratorcBswtZdZdddZdZdZdZdZdZ	d	Z
d
ZdZdZ
d
ZRS(Nsxml.sax.saxutils.prefix%ss
iso-8859-1cCs|djodk}|i}ntii|t|||_
hg|_|id|_g|_
||_d|_dS(Nii(toutR#R7tstdoutthandlertContentHandlerR!RR?R<t_outt_ns_contextst_current_contextt_undeclared_ns_mapst	_encodingt_generated_prefix_ctr(RROR<R7((RR!s
	
			cCs|iid|idS(Ns$<?xml version="1.0" encoding="%s"?>
(RRSR,RW(R((Rt
startDocumentscCs@|ii|ii||i|<|ii||fdS(N(RRTtappendRUtcopytprefixturiRV(RR\R]((RtstartPrefixMappings
cCs|id|_|id=dS(Ni(RRTRU(RR\((RtendPrefixMappingscCsi|iid|x>|iD]0\}}|iid|t|i|q!W|iiddS(NR	s %s=R
(RRSR,tnametattrsRRRM(RR`RaR((RtstartElements
cCs|iid|dS(Ns</%s>(RRSR,R`(RR`((Rt
endElementscCs|ddjo|d}nD|i|ddjo|d}n|i|dd|d}|iid|x]|iD]R\}}|djo|iid|pdq|iid||fqWg|_x|i
D]\}}|ddjo|d}n|i|ddjok|i|i
}|i
d|_
|d|d}|iid|t|df||i|d<n|i|dd|d}|iid	|t|i|qW|iid
dS(Niit:R	s xmlns="%s"ts xmlns:%s="%s"s xmlns:%s=%ss %s=R
(R`R#RRURSR,RVtktvRaRRtGENERATED_PREFIXRXR\RRM(RR`tqnameRaRfRR\Rg((RtstartElementNSs4

	
$cCsz|ddjo|d}nD|i|ddjo|d}n|i|dd|d}|iid|dS(NiiRds</%s>(R`R#RiRRURSR,(RR`Ri((RtendElementNS(scCst|i|dS(N(RERRStcontent(RRl((Rt
characters4scCs|ii|dS(N(RRSR,Rl(RRl((RtignorableWhitespace7scCs|iid||fdS(Ns	<?%s %s?>(RRSR,ttargetR(RRoR((RtprocessingInstruction:s(RRRhR#R!RYR^R_RbRcRjRkRmRnRp(((RRNs						#			tLexicalXMLGeneratorcBsStZdZeddZdZdZdZdZdZ	dZ
RS(	s>A XMLGenerator that also supports the LexicalHandler interfaces
iso-8859-1cCs ti|||d|_dS(Ni(RNR!RROR<t	_in_cdata(RROR<((RR!AscCsD|io |ii|iddn|iit|dS(Ns]]>s]]>]]&gt;<![CDATA[(RRrRSR,RlRR
(RRl((RRmEs
 cCs|iid||o8|iidt|pdt|pdfn-|o%|iidt|pdndS(Ns<!DOCTYPE %ss
 PUBLIC %s %sRes
 SYSTEM %s(RRSR,R`t	public_idRt	system_id(RR`RsRt((RtstartDTDNs
8cCs|iiddS(NR
(RRSR,(R((RtendDTDWscCs4|iid|ii||iiddS(Ns<!--s-->(RRSR,Rl(RRl((RtcommentZscCsd|_|iiddS(Nis	<![CDATA[(RRrRSR,(R((Rt
startCDATA_s	cCsd|_|iiddS(Nis]]>(RRrRSR,(R((RtendCDATAcs	(RRRR#R!RmRuRvRwRxRy(((RRq>s							tContentGeneratorcBstZdZRS(NcCsti|||||!S(N(RNRmRtstrtstarttend(RR{R|R}((RRmks(RRRm(((RRzist
XMLFilterBasecBstZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZRS(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.cCs|ii|dS(N(Rt_err_handlerR1R.(RR.((RR1{scCs|ii|dS(N(RRR2R.(RR.((RR2~scCs|ii|dS(N(RRR0R.(RR.((RR0scCs|ii|dS(N(Rt
_cont_handlertsetDocumentLocatorR(RR((RRscCs|iidS(N(RRRY(R((RRYscCs|iidS(N(RRtendDocument(R((RRscCs|ii||dS(N(RRR^R\R](RR\R]((RR^scCs|ii|dS(N(RRR_R\(RR\((RR_scCs|ii||dS(N(RRRbR`Ra(RR`Ra((RRbscCs|ii|dS(N(RRRcR`(RR`((RRcscCs|ii|||dS(N(RRRjR`RiRa(RR`RiRa((RRjscCs|ii||dS(N(RRRkR`Ri(RR`Ri((RRkscCs|ii|dS(N(RRRmRl(RRl((RRmscCs|ii|dS(N(RRRntchars(RR((RRnscCs|ii||dS(N(RRRpRoR(RRoR((RRpscCs|ii|dS(N(RRt
skippedEntityR`(RR`((RRscCs|ii|||dS(N(Rt_dtd_handlertnotationDeclR`tpublicIdtsystemId(RR`RR((RRscCs|ii||||dS(N(RRtunparsedEntityDeclR`RRtndata(RR`RRR((RRscCs|ii||dS(N(Rt_ent_handlert
resolveEntityRR(RRR((RRscCsT|ii||ii||ii||ii||ii|dS(N(Rt_parenttsetContentHandlertsetErrorHandlertsetEntityResolvert
setDTDHandlertparsetsource(RR((RRs
cCs|ii|dS(N(RRt	setLocaletlocale(RR((RRscCs|ii|S(N(RRt
getFeatureR`(RR`((RRscCs|ii||dS(N(RRt
setFeatureR`tstate(RR`R((RRscCs|ii|S(N(RRtgetPropertyR`(RR`((RRscCs|ii||dS(N(RRtsetPropertyR`R(RR`R((RRs(RRRR1R2R0RRYRR^R_RbRcRjRkRmRnRpRRRRRRRRRR(((RR~qs4																								tBaseIncrementalParsercBs tZdZdZdZRS(sThis class implements the parse method of the XMLReader
    interface using the feed, close and reset methods of the
    IncrementalParser interface as a convenience to SAX 2.0 driver
    writers.cCst|}|i||ii|i}|id}x.|djo |i
||id}qDW|i|i|ii
dS(Ni@Re(tprepare_input_sourceRRt
prepareParserRRYt
getByteStreamtinftreadtbuffertfeedtclosetresetR(RRRR((RRs





cCstddS(stThis method is called by the parse implementation to allow
        the SAX 2.0 driver to prepare itself for parsing.s!prepareParser must be overridden!N(tNotImplementedError(RR((RRs(RRRRR(((RRs	RecCsEt|tjoti|}nXt|doG|}ti}|i|t|do|i|i	q}n|i
djo|i}tiitii|}tii||}tii|o |i|t|d}n/|iti||ti|i}|i|n|S(sThis function takes an InputSource and an optional base URL and
    returns a fully resolved InputSource object ready for reading.RR`trbN(ttypeRt_StringTypest	xmlreadertInputSourcethasattrtft
setByteStreamtsetSystemIdR`RR#Rtsysidtostpathtdirnametnormpathtbasetbaseheadtjoint
sysidfilenametisfiletopenturlparseturljointurllib2turlopen(RRRRRR((RRs(

tAttributeMapcBstZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Ze
dZdZd
ZRS(szAn implementation of AttributeList that takes an (attr,val) hash
    and uses it to implement the AttributeList interface.cCs
||_dS(N(tmapR(RR((RR!scCst|iiS(N(tlenRRtkeys(R((Rt	getLength!scCs5y|ii|SWntj
o
}dSnXdS(N(RRRtit
IndexErrorteR#(RRR((RtgetName$scCsdS(NtCDATA((RR((RtgetType*scCs]y=t|tijo|i|i|Sn|i|SWntj
o
}dSnXdS(N(
RRttypestIntTypeRRRtKeyErrorRR#(RRR((RtgetValue-scCs
t|iS(N(RRR(R((Rt__len__6scCs:t|tijo|ii|Sn|i|SdS(N(RRRRRRR(RR((Rt__getitem__9scCs
|iiS(N(RRR(R((RR?scCs
|iiS(N(RRR(R((RRBscCs|ii|S(N(RRthas_keyR(RR((RREscCs|ii||S(N(RRtgetRtalternative(RRR((RRHscCst|iiS(N(RRRR[(R((RR[KscCs
|iiS(N(RRtvalues(R((RRNs(RRRR!RRRRRRRRRR#RR[R(((RRs												tEventBroadcastercBs<tZdZdfdYZdZdZdZRS(sTakes a list of objects and forwards any method calls received
    to all objects in the list. The attribute list holds the list and
    can freely be modified by clients.tEventcBs tZdZdZdZRS(s,Helper objects that represent event methods.cCs||_||_dS(N(tlistRR`(RRR`((RR![s	cGs1x*|iD]}tt||i|q
WdS(N(RRtobjtapplytgetattrR`trest(RRR((Rt__call___s
(RRRR!R(((RRXs	cCs
||_dS(N(RR(RR((RR!cscCs|i|i|S(N(RRRR`(RR`((Rt__getattr__fscCsdt|S(Ns!<EventBroadcaster instance at %d>(tidR(R((Rt__repr__is(RRRRR!RR(((RRSs
		tESISDocHandlercBsAtZdZeidZdZdZdZdZ	RS(s7A SAX document handler that produces naive ESIS output.cCs
||_dS(N(twriterR(RR((RR!qscCs$|iid|d|ddS(sQReceive an event signalling that a processing instruction
        has been found.R"t s
N(RRR,Rot	remainder(RRoR((RRptscCsW|iid|dx8|iD]*}|iid|d||dq%WdS(s4Receive an event signalling the start of an element.t(s
tARN(RRR,R`tamapRta_name(RR`RR((RRbys

cCs|iid|ddS(s2Receive an event signalling the end of an element.t)s
N(RRR,R`(RR`((RRcscCs'|iid||||!ddS(s?Receive an event signalling that character data has been found.t-s
N(RRR,Rtstart_ixtlength(RRRR((RRms(
RRRR7RPR!RpRbRcRm(((RRns			t	CanonizercBsStZdZeidZdZdZdZdZ	dZ
dZRS(s:A SAX document handler that produces canonized XML output.cCsd|_||_dS(Ni(Rt
elem_levelR(RR((RR!s	cCs5|djp$|iid|d|dndS(Ntxmls<?Rs?>(RoRRR,R(RRoR((RRps
cCs|iid||i}|ixG|D]?}|iid|d|i	|||iidq1W|iid|i
d|_
dS(NR	Rs="s"R
i(RRR,R`RRta_namestsortRt
write_dataR(RR`RRR((RRbs
cCs,|iid|d|id|_dS(Ns</R
i(RRR,R`R(RR`((RRcscCs|i|||dS(N(RRmRRR(RRRR((RRnscCs0|idjo|i||||!ndS(Ni(RRRRRR(RRRR((RRmscCs|idd}|idd}|idd}|idd}|itd	d
}|itdd}|itd
d}|ii|dS(sWrites datachars to writer.Rs&amp;R	s&lt;s"s&quot;R
s&gt;i	s&#9;i
s&#10;i
s&#13;N(RRtchrRRR,(RR((RRs(RRRR7RPR!RpRbRcRnRmR(((RRs		
			tmllibcBstZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
eieifdYZRS(s_A re-implementation of the htmllib, sgmllib and xmllib interfaces as a
    SAX DocumentHandler.cCs|idS(N(RR(R((RR!scCsDdk}|ii|_ti|i||_|iidS(N(	tsaxextstXMLParserFactorytmake_parserRtparserRtHandlerRQR(RR((RRs	cCs|ii|dS(N(RRRR(RR((RRscCs|iidS(N(RRR(R((RRscCs
|iiS(N(RRQt	get_stack(R((RRscCs||dS(N(tmethodtatts(RR`RR((Rthandle_starttagscCs|dS(N(R(RR`R((Rt
handle_endtagscCsdS(N((RR((Rthandle_datascCsdS(N((RRoR((Rthandle_procscCsdS(N((RR`R((Rtunknown_starttagscCsdS(N((RR`((Rtunknown_endtagscCsdS(N((Rtmessage((Rtsyntax_errorsRcBshtZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZRS(sRAn internal class to handle SAX events and translate them to mllib
        events.cCs@||_|ii||ii|||_|idS(N(tdriverRtsetDocumentHandlerRRQR(RRRQ((RR!s
		cCs|iS(N(Rtstack(R((RRscCs
g|_dS(N(RR(R((RRscCs|ii||||!dS(N(RRQRtchR|R(RRR|R((RRmscCs\t|id|o'|ii|t|id|n|ii||id=dS(Ntend_i(RRRQR`RRRR(RR`((RRc
s
cCs|ii||||!dS(N(RRQRRR|R(RRR|R((RRnscCs|ii||dS(N(RRQRRoR(RRoR((RRpscCsh|ii|t|id|o*|ii|t|id||n|ii	||dS(Ntstart_(
RRRZR`RRQRRRR(RR`R((RRbs	
cCs|iit|dS(N(RRQRR{R.(RR.((RR1&scCstt|dS(N(tRuntimeErrorR{R.(RR.((RR2)s(
RRRR!RRRmRcRnRpRbR1R2(((RRs									
	(RRRR!RRRRRRRRRRRtsaxlibtDocumentHandlertErrorHandlerR(((RRs												(0RRRRRRQRR7R4R	t
StringTypetUnicodeTypeRtAttributeErrorRR
RRtEntityResolvert
DTDHandlerRRRRRR'R9tAttributesImplR:R?RRERMRNtLexicalHandlerRqRzt	XMLFilterR~t
XMLFilterImpltIncrementalParserRRRRtHandlerBaseRRR(#RzRRRR
R?RMRRQRRNRRRRRqRRERRRR7R	R:RR~RR4RRRRR'R9R((RR"sH$			+	&#
			b+b$9	0

Anon7 - 2021