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/writer.pyc
m
4)$?c@s3dZdZdkZdkZdkZdklZdZdfdYZ	de	fdYZ
d	e	fd
YZdefdYZd
fdYZ
deiiiifdYZde
fdYZdefdYZde
fdYZdfdYZdefdYZdS(sSAX document handlers that support output generation of XML, SGML,
and XHTML.

This module provides three different groups of objects: the actual SAX
document handlers that drive the output, DTD information containers,
and syntax descriptors (of limited public use in most cases).


Output Drivers
--------------

The output drivers conform to the SAX C<DocumentHandler> protocol.
They can be used anywhere a C<DocumentHandler> is used.  Two drivers
are provided: a `basic' driver which creates a fairly minimal output
without much intelligence, and a `pretty-printing' driver that
performs pretty-printing with nice indentation and the like.  Both can
optionally make use of DTD information and syntax objects.


DTD Information Containers
--------------------------



Each DTD information object provides an attribute C<syntax> which
describes the expected output syntax; an alternate can be provided to
the output drivers if desired.


Syntax Descriptors
------------------

Syntax descriptor objects provide several attributes which describe
the various lexical components of XML & SGML markup.  The attributes
have names that reflect the shorthand notation from the SGML world,
but the values are strings which give the appropriate characters for
the markup language being described.  The one addition is the
C<empty_stagc> attribute which should be used to end the start tag of
elements which have no content.  This is needed to properly support
XML and XHTML.

s$Revision: 1.9 $N(sescapeiJtSyntaxcBswtZdZdZdZdZdZdZdZdZ	d	Z
d
ZdZdZ
d
ZdZdZdZdZdZRS(Ns--s&#t;t[t]t&t"s&quot;t's<!t>s]]s<?t<s</t=cCs!|itjo
tdndS(Ns%Syntax must be subclassed to be used!(tselft	__class__RtRuntimeError(R
((t7/usr/lib/python2.4/site-packages/_xmlplus/sax/writer.pyt__init__Ks(t__name__t
__module__tcomtcrotrefctdsotdscterotlitt
lit_quotedtlitatmdotmdctmsctpiotstagotetagottagctviR(((R
R8s$t
SGMLSyntaxcBstZdZdZdZRS(NRt/(RRtempty_stagctpictnet(((R
R"Pst	XMLSyntaxcBstZdZdZdZRS(Ns/>s?>(RRR$R%tNoneR&(((R
R'VstXHTMLSyntaxcBstZdZRS(Ns />(RRR$(((R
R)\stDoctypeInfocBstZeZdZdZdZdZdZ	dZ
dZdZdZ
dZd	Zd
ZdZRS(NcCsh|_h|_h|_dS(N(R
t_DoctypeInfo__emptiest_DoctypeInfo__elements_onlyt_DoctypeInfo__attribs(R
((R
Rgs		cCs|ii|S(N(R
R+thas_keytgi(R
R/((R
tis_emptylscCs
|iiS(N(R
R+tkeys(R
((R
tget_empties_listoscCs|ii|S(N(R
R,R.R/(R
R/((R
thas_element_contentrscCs
|iiS(N(R
R,R1(R
((R
tget_element_containers_listuscCs|ii|hiS(N(R
R-tgetR/R1(R
R/((R
tget_attributes_listxscCs|i||S(N(R
R-R/tattr(R
R/R7((R
tget_attribute_info{scCsd|i|<dS(Ni(R
R+R/(R
R/((R
t	add_empty~scCs||i|<dS(N(R/R
R,(R
R/((R
tadd_element_containerscCsry|i|}Wn$tj
oh}|i|<nX|i|p|||f||<nd||fGHdS(Ns!<%s> attribute %s already defined(
R
R-R/tdtKeyErrorR.R7ttypetdecltdefault(R
R/R7R=R>R?R;((R
tadd_attribute_defnscCs
tddS(Ns'sublasses must implement load_pubtext()(tNotImplementedError(R
tpubtext((R
tload_pubtexts(RRR'tsyntaxR(tfpitsysidRR0R2R3R4R6R8R9R:R@RC(((R
R*as											
t
_XMLDTDLoadercBstZdZdZRS(NcCs5||_tiiiii|||i	|_
dS(N(tinfoR
txmltparserstxmlproctxmlapptDTDConsumerRtparserR@t
new_attribute(R
RHRN((R
Rs	cCsh|ddjo|dddjon;|dgdfjo|ii|n|ii|dS(Nit|is#PCDATAt(s#PCDATARQ(tmodelR
RHR9R/R:(R
R/RR((R
tnew_element_types
&(RRRRS(((R
RGs	tXMLDoctypeInfocBstZdZRS(NcCsBtiiii}t||}|i	||i
|dS(N(RIRJRKt	dtdparsert	DTDParserRNRGR
tloadertset_dtd_consumertparse_resourceRF(R
RFRNRW((R
RCs
(RRRC(((R
RTstXHTMLDoctypeInfocBstZeZRS(N(RRR)RD(((R
RZstSGMLDoctypeInfocBsJtZeZdkZeideiiZe	dZ
[dZRS(Ns	<!ELEMENTcCst|i}|i|}x|o||i}|o'|dti	joti
|}nq$ti|dd\}}ti
|}td|i|}q$WdS(Niisimplementation incomplete(topenRFtreadRBR
t'_SGMLDoctypeInfo__element_prefix_searchtmtendtstringt
whitespacetlstriptsplitR(R/RA(R
RFR_RBR/((R
RCs	(RRR"RDtretcompilet
IGNORECASEtsearchR^tlent$_SGMLDoctypeInfo__element_prefix_lenRC(((R
R[s		t	XmlWritercBstZdZeeeeddZdZdZdZhdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZRS(sBasic XML output handler.s
iso-8859-1cCsd|_d|_d|_|i|_d|_d|_	||_g|_d|_
d|_d|_||_||_|djo!|o
|i}qt}n||_d|_d|_|djo
t|_n
||_dS(NiiRQ(R
t_offsett_packingt_flowingtfptwritet_writeR(t_dtdflowingt_prefixtencodingt	_encodingt_XmlWriter__stackt_XmlWriter__langt_XmlWriter__pending_contentt_XmlWriter__pending_doctypet
standalonet_XmlWriter__standalonetdtdinfot_XmlWriter__dtdinfoRDR't_XmlWriter__syntaxtindentationt
indentEndTagst
linelengthtDEFAULT_LINELENGTHt
lineLength(R
RoRzR|RDRRt((R
Rs.												


			

cCs
||_dS(N(tlocatorR
(R
R((R
tsetDocumentLocatorscCs|iidjo|ii}d|ii|||ii||i|f}|io&d||ii||i|f}n|i	d||iifndS(Ns?>s&%sxml version=%s1.0%s encoding%s%s%s%ss%s standalone%s%s%s%ss%s%s
(
R
R~R%RRR!RutsR{Rq(R
RR((R
t
startDocuments.
&cCs|io
tdndS(Ns+open element stack cannot be empty on close(R
RvR(R
((R
tendDocuments
cCs|io|i|n|i|i||i|||ido|d|_	|d=n|i
o
d}n&|io|i
|i }nd}d||ii|f}d|t|df}|ii}|ii}
|ii}d}|i|iddjoN|idj	o|i|ijoqid||d	d
g|i|f}n|i	|iddjo d||||i|f}n||}	|it|	|_d}x`|iD]R\}}|djoqnt |}t!i"||djo)d
|||t#t ||f}nzt!i"||
djo)d
|||
t#t ||
f}n8d
|||t#t |h||ii$<|
f}|it||i%jo.|i&|	d||}	t|	|_q|	|}	|it||_qW|i&|	d|_'|i(o4|i(i)|p|i(i*|o
d|_
ndS(Nsxml:langRQs%s%s%ss%s %st iis xml:space%s%s%s%sR?tpreserveis%s xml:lang%s%s%s%ss %s%s%s%s%ss
(+R
Rythandle_doctypettagt_check_pending_contentt_XmlWriter__pushtagt_XmlWriter__check_flowingtattrsR.RwRmtprefixRnRsRR~RtstagRiRRR!taRvRrR(tlangtlineRltitemstktvtstrRatfindtescapeRRRqRxR}R3R0(R
RRRR!RRRRRRR((R
tstartElements`






#' 


))7


	1cCs|io|ioW|i|ii|io |it|ii|_q|idd|_n0|i|ii|it|ii|_d|_|i	|dSnt|i}|djp|ip|io
d}n|i|i d|i}|i	||id||ii||iif|io|it|d|_n|idd|_dS(Ns
iiRQRs%s%s%s%si(R
RxRnRqR~R$RmRlRit_XmlWriter__poptagRRvtdepthRRsRRRR (R
RRR((R
t
endElement9s,


 

	
"

)

cCs||||!}|o|it|}d|jo-ti|d}t	||d|_
n|i
t	||_
|i|i|ndS(Ns
i(tdatatstarttlengthR
RRRaRtpRiRlRq(R
RRRR((R
t
charactersXs


cCs||||!}|id|ii|ii||ii|iif}t
i|d}|i
oB|djot||d|_q|it||_n$|id|i|fd|_dS(Ns
%s%s%s%s%ss
iis%s%s
(RRRR
RR~RRRRRatrfindRRmRiRlRqRs(R
RRRRR((R
tcommentes
1

cCsdS(N((R
RRR((R
tignorableWhitespacetscCs$|id|ii|||iif}|i|i	 d|i
}d|joqti
|d}|io-|io"|i||dd|_q |i|t||d|_n[|io-|io"|i||dd|_n$|i||it||_dS(Ns	%s%s %s%sRs
ii(R
RR~RttargetRR%RRsRRRRaRRRnRmRqRlRi(R
RRRRR((R
tprocessingInstructionws
"




cCsrd|_|io|ii}|ii}nd}}|ii}|iidj}|o|od|ii
|f}|o2|d|||f}|d|||f}n|d|||f}|i
|d|_n|pd|ii
|f}|od||||f}n|od	||||f}n|i
d
||iifd|_ndS(Nis?>s
%sDOCTYPE %s
s  PUBLIC %s%s%s
s         %s%s%s>
s  SYSTEM %s%s%s>
s%sDOCTYPE %ss%s
  PUBLIC %s%s%ss%s
  SYSTEM %s%s%ss%s%s
(R
RyR}RERFR(R~RR%tisxmlRtrootRRqRlR(R
RRERRRFR((R
Rs.	



cCs|i|iid}|ii|ii}d|t||f}|ioyd|jo7ti
|d}t||dt||_n%|it|t|||_|i|nd|_|i|ddS(Ns[CDATA[s%s%s%ss
ii(R
RR~RRRRR`RRRRmRaRtrposRiRlRq(R
RRR`RR((R
thandle_cdatas


%$	cCsl|ii}|\|_|_}|_|_||jot
d||fn|i|i |_dS(Nsexpected </%s>, got </%s>(
R
RvtpoptstateRnRwtexpected_tagRmRrRRRsR(R
RRR((R
t__poptags
!
cCsF|ii|i|i||i|if|id|i	|_dS(NR(
R
RvtappendRnRwRRmRrRsR(R
R((R
t	__pushtags+cCsd}}|ioiy|ii|d}Wntj
o
d}nX|dj	o#|ddj|_	|i	|_
q}n|ido|ddj|_	|d=ndS(snCheck the contents of attrs and the DTD information to determine
        whether the following content should be flowed.

        tag -- general identifier of the element being opened
        attrs -- attributes dictionary as reported by the parser or
                 application

        This sets up both the _flowing and _dtdflowing (object) attributes.
        s	xml:spaceiRN(
R(tdocspectdtdspecR
R}R8RRHR<RnRrRR.(R
RRRHRR((R
t__check_flowings	


cCsv|ioh|ii}|io"|io|d}d|_n|it||_|i	|d|_ndS(Ns
i(
R
RxR~R RRnRmRlRiRq(R
R((R
Rs



(RRt__doc__R(RRRRRRRRRRRRRRRR(((R
Rks"			;		
									t
PrettyPrintercBs2tZdZeeeededZdZRS(s#Pretty-printing XML output handler.icCsXti||d|d|d|d|||_|dj	o
||_n
||_dS(NRzR|RDR(RkRR
RoRzR|RDRRtendtagindentationR(R(R
RoRzR|RDRRR((R
Rs	

cCs||||!}|pdSn|it|}|ip|i|dSnti	|}
|dtij}|
o|dtij}|i}t|djo
d}n|i}g}
|
i}	|o|	d|d}nd}d}x|
o|
d}|
d=||t||ijo8|	d|	||	|t|t|}q|	|d	\}}|	||dt|}qW|o|	d|d}n||_|iti|
ddS(
Niii(s    RiRQs
(Ri(RRRR
RRRnRqRaRdtwordsRbtbegspacetendspaceRsRRiRltoffsettLRtwstws_lentwRtjoin(R
RRRRRRRRRRRRR((R
RsP


	
		







	(RRRR(RR(((R
Rs(Rt__version__Ratxml.parsers.xmlproc.dtdparserRItxml.parsers.xmlproc.xmlapptxml.sax.saxutilsRRRR"R'R)R*RJRKRLRMRGRTRZR[RkR(RIRRkRZRaR'R[RR*RTRRR"RRGR)((R
t?*s$			
1"#

Anon7 - 2021