ó SÑX=c@sªdZddlZddlZddlZddlTddd„ƒYZddd„ƒYZddd „ƒYZd dd „ƒYZd dd „ƒYZ ddd„ƒYZ dS(s} This file contains the default classes that are used to receive events from the XML parser. All these classes are meant to be subclassed (or imitated) by clients that want to handle these functions themselves. Application is the class that receives document data from the parser, and is probably the one most people want. $Id: xmlapp.py,v 1.12 2002/08/13 09:28:51 afayolle Exp $ iÿÿÿÿN(t*t ApplicationcBszeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „ZRS( s‡This is the class that represents the application that receives parsed data from the parser. It is meant to be subclassed by users.cCs d|_dS(N(tNonetlocator(tself((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt__init__scCs ||_dS(slGives the application an object to ask for the current location. Called automagically by the parser.N(R(RR((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt set_locatorscCsdS(s6Notifies the application of the start of the document.N((R((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt doc_startscCsdS(s4Notifies the application of the end of the document.N((R((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytdoc_end#scCsdS(s%Notifies the application of comments.N((Rtdata((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pythandle_comment'scCsdS(s@Notifies the application of start tags (and empty element tags).N((Rtnametattrs((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pythandle_start_tag+scCsdS(s>Notifies the application of end tags (and empty element tags).N((RR ((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pythandle_end_tag/scCsdS(s+Notifies the application of character data.N((RR tstarttend((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt handle_data3scCsdS(s?Notifies the application of character data that can be ignored.N((RR RR((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pythandle_ignorable_data7scCsdS(s4Notifies the application of processing instructions.N((RttargetR ((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt handle_pi;scCsdS(s:Notifies the application of the document type declaration.N((RtroottpubIDtsysID((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pythandle_doctype?scCsdS(s´Notifies the application of information about the current entity supplied by an XML or text declaration. All three parameters will be None, if they weren't present.N((Rtxmlvertenctsddecl((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytset_entity_infoCs(t__name__t __module__t__doc__RRRRR R RRRRRR(((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyRs           t PubIdResolvercBs)eZdZd„Zd„Zd„ZRS(sPAn application class that resolves public identifiers to system identifiers.cCs|S(s—Maps the public identifier of a parameter entity to a system identifier. The default implementation just returns the system identifier.((Rtpubidtsysid((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytresolve_pe_pubidQscCs|S(sœMaps the public identifier of the DOCTYPE declaration to a system identifier. The default implementation just returns the system identifier.((RR!R"((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytresolve_doctype_pubidWscCs|S(s—Maps the public identifier of an external entity to a system identifier. The default implementation just returns the system identifier.((RR!R"((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytresolve_entity_pubid]s(RRRR#R$R%(((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR Ms  t ErrorHandlercBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(swAn error handler for the parser. This class can be subclassed by clients that want to use their own error handlers.cCs ||_dS(N(R(RR((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyRkscCs ||_dS(N(R(Rtloc((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyRnscCs|jS(N(R(R((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt get_locatorqscCsdS(s"Handles a non-fatal error message.N((Rtmsg((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytwarningtscCs|j|ƒdS(N(tfatal(RR)((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyterrorxscCs‡|jdkrd|GHn[d|d|jjƒ|jjƒ|jjƒfGHd|jj|jj|jjd!GHtjdƒdS(sHandles a fatal error message.sERROR: s at %s:%d:%ds TEXT: '%s'i iN( RRtget_current_sysidtget_linet get_columnR tpostsystexit(RR)((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR+~s  ( RRRRRR(R*R,R+(((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR&gs     t EntityHandlercBs eZdZd„Zd„ZRS(s!An entity handler for the parser.cCs ||_dS(N(tparser(RR4((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR‘scCs>ydt|fSWn%tk r9|jjd|ƒdSXdS(sResolves a general entity reference and returns its contents. The default method only resolves the predefined entities. Returns a 2-tuple (n,m) where n is true if the entity is internal. For internal entities m is the value, for external ones it is the system id.iiÍ tN(iR5(t predef_entstKeyErrorR4t report_error(Rtentname((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytresolve_ent_ref”s  (RRRRR:(((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR3Žs t DTDConsumercBszeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „ZRS( s|Represents an XML DTD. This class can be subclassed by applications which want to handle the DTD information themselves.cCs ||_dS(N(R4(RR4((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR¨scCsdS(sCalled when DTD parsing starts.N((R((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt dtd_start«scCsdS(s)Called when the DTD is completely parsed.N((R((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytdtd_end¯scCsdS(s.Receives internal general entity declarations.N((RR tval((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytnew_general_entity³scCsdS(skReceives external general entity declarations. 'ndata' is the empty string if the entity is parsed.N((Rtent_nametpub_idtsys_idtndata((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytnew_external_entity·scCsdS(s0Receives internal parameter entity declarations.N((RR R>((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytnew_parameter_entity¼scCsdS(s0Receives external parameter entity declarations.N((RR R!R"((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytnew_external_peÀscCsdS(sReceives notation declarations.N((RR R!R"((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt new_notationÄscCsdS(s,Receives the declaration of an element type.N((Rt elem_namet elem_cont((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytnew_element_typeÈscCsdS(s,Receives the declaration of a new attribute.N((Rtelemtattrta_typeta_declta_def((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt new_attributeÌscCsdS(s#Receives the contents of a comment.N((Rtcontents((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR ÐscCsdS(s8Receives the target and data of processing instructions.N((RRR ((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyRÔs(RRRRR<R=R?RDRERFRGRJRPR R(((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyR;¤s           tInputSourceFactorycBseZdZd„ZRS(s?A class that creates file-like objects from system identifiers.cCsG|dd!dks,tj|ƒddkr6t|ƒStj|ƒSdS(Niis:\iR5(turlparsetopenturllib2turlopen(RR"((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pytcreate_input_sourceßs, (RRRRW(((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyRRÜs((((((( RR1RURStxmlutilsRR R&R3R;RR(((sL/opt/freeware/lib/python2.7/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pyt s$ :'8