-í
x‚…=c       s¼     d  Z  	  d k Z d k Z d k Z  d k T d f  d „  ƒ  YZ M d f  d „  ƒ  YZ g d f  d „  ƒ  YZ Ž d	 f  d
 „  ƒ  YZ ¤ d f  d „  ƒ  YZ	 Ü d f  d „  ƒ  YZ
 d S(   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 $
N(   s   *s   Applicationc      sž    d  Z    d „  Z  d „  Z  d „  Z # d „  Z ' d „  Z + d „  Z / d „  Z 3 d „  Z 7 d	 „  Z	 ; d
 „  Z
 ? d „  Z C d „  Z RS(   s‡   This is the class that represents the application that receives
    parsed data from the parser. It is meant to be subclassed by users.c    s     t  |  _ d  S(   N(   s   Nones   selfs   locator(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   __init__ s   c    s      | |  _  d S(   sl   Gives the application an object to ask for the current location.
        Called automagically by the parser.N(   s   locators   self(   s   selfs   locator(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   set_locator s   c    s      ! d S(   s6   Notifies the application of the start of the document.N(    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys	   doc_start s   c    s   # $ % d S(   s4   Notifies the application of the end of the document.N(    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   doc_end# s   c    s   ' ( ) d S(   s%   Notifies the application of comments.N(    (   s   selfs   data(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   handle_comment' s   c    s   + , - d S(   s@   Notifies the application of start tags (and empty element tags).N(    (   s   selfs   names   attrs(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   handle_start_tag+ s   c    s   / 0 1 d S(   s>   Notifies the application of end tags (and empty element tags).N(    (   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   handle_end_tag/ s   c    s   3 4 5 d S(   s+   Notifies the application of character data.N(    (   s   selfs   datas   starts   end(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   handle_data3 s   c    s   7 8 9 d S(   s?   Notifies the application of character data that can be ignored.N(    (   s   selfs   datas   starts   end(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   handle_ignorable_data7 s   c    s   ; < = d S(   s4   Notifies the application of processing instructions.N(    (   s   selfs   targets   data(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys	   handle_pi; s   c    s   ? @ A d S(   s:   Notifies the application of the document type declaration.N(    (   s   selfs   roots   pubIDs   sysID(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   handle_doctype? s   c    s   C F G d S(   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(    (   s   selfs   xmlvers   encs   sddecl(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   set_entity_infoC s   (   s   __doc__s   __init__s   set_locators	   doc_starts   doc_ends   handle_comments   handle_start_tags   handle_end_tags   handle_datas   handle_ignorable_datas	   handle_pis   handle_doctypes   set_entity_info(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   Application s   	s   PubIdResolverc      s2   M d  Z  O Q d „  Z W d „  Z ] d „  Z RS(   sP   An application class that resolves public identifiers to system
    identifiers.c    s   Q T U | Sd S(   s—   Maps the public identifier of a parameter entity to a system
        identifier. The default implementation just returns the system
        identifier.N(   s   sysid(   s   selfs   pubids   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   resolve_pe_pubidQ s   c    s   W Z [ | Sd S(   sœ   Maps the public identifier of the DOCTYPE declaration to a system
        identifier. The default implementation just returns the system
        identifier.N(   s   sysid(   s   selfs   pubids   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   resolve_doctype_pubidW s   c    s   ] ` a | Sd S(   s—   Maps the public identifier of an external entity to a system
        identifier. The default implementation just returns the system
        identifier.N(   s   sysid(   s   selfs   pubids   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   resolve_entity_pubid] s   (   s   __doc__s   resolve_pe_pubids   resolve_doctype_pubids   resolve_entity_pubid(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   PubIdResolverM s   	s   ErrorHandlerc      sV   g d  Z  i k d „  Z n d „  Z q d „  Z t d „  Z x d „  Z ~ d „  Z RS(   sw   An error handler for the parser. This class can be subclassed by clients
    that want to use their own error handlers.c    s   k l | |  _  d  S(   N(   s   locators   self(   s   selfs   locator(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   __init__k s   c    s   n o | |  _ d  S(   N(   s   locs   selfs   locator(   s   selfs   loc(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   set_locatorn s   c    s   q r |  i Sd  S(   N(   s   selfs   locator(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   get_locatorq s   c    s   t u v d S(   s"   Handles a non-fatal error message.N(    (   s   selfs   msg(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   warningt s   c    s   x y |  i | ƒ d  S(   N(   s   selfs   fatals   msg(   s   selfs   msg(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   errorx s   c    sž   ~  € |  i t j o  d | GHnb ƒ d | d |  i i ƒ  |  i i ƒ  |  i i ƒ  f GH† d |  i i |  i i |  i i d !GHˆ t	 i
 d ƒ d S(   s   Handles a fatal error message.s   ERROR: s    at %s:%d:%ds
   TEXT: '%s'i
   i   N(   s   selfs   locators   Nones   msgs   get_current_sysids   get_lines
   get_columns   datas   poss   syss   exit(   s   selfs   msg(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   fatal~ s   8)(   s   __doc__s   __init__s   set_locators   get_locators   warnings   errors   fatal(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   ErrorHandlerg s   	s   EntityHandlerc      s&   Ž d  Z   ‘ d „  Z ” d „  Z RS(   s!   An entity handler for the parser.c    s   ‘ ’ | |  _  d  S(   N(   s   parsers   self(   s   selfs   parser(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   __init__‘ s   c    s^   ” ˜ š y › d t  | f SWn9 œ t j
 o*  |  i i d | ƒ ž d d f Sn Xd S(   s  Resolves 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.i   iÍ  s    N(   s   predef_entss   entnames   KeyErrors   selfs   parsers   report_error(   s   selfs   entname(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   resolve_ent_ref” s   (   s   __doc__s   __init__s   resolve_ent_ref(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   EntityHandlerŽ s   	s   DTDConsumerc      sž   ¤ d  Z  ¦ ¨ d „  Z « d „  Z ¯ d „  Z ³ d „  Z · d „  Z ¼ d „  Z À d „  Z Ä d „  Z È d	 „  Z	 Ì d
 „  Z
 Ð d „  Z Ô d „  Z RS(   s|   Represents an XML DTD. This class can be subclassed by applications
    which want to handle the DTD information themselves.c    s   ¨ © | |  _  d  S(   N(   s   parsers   self(   s   selfs   parser(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   __init__¨ s   c    s   « ¬ ­ d S(   s   Called when DTD parsing starts.N(    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys	   dtd_start« s   c    s   ¯ ° ± d S(   s)   Called when the DTD is completely parsed.N(    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   dtd_end¯ s   c    s   ³ ´ µ d S(   s.   Receives internal general entity declarations.N(    (   s   selfs   names   val(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   new_general_entity³ s   c    s   · ¹ º d S(   sk   Receives external general entity declarations. 'ndata' is the
        empty string if the entity is parsed.N(    (   s   selfs   ent_names   pub_ids   sys_ids   ndata(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   new_external_entity· s   c    s   ¼ ½ ¾ d S(   s0   Receives internal parameter entity declarations.N(    (   s   selfs   names   val(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   new_parameter_entity¼ s   c    s   À Á Â d S(   s0   Receives external parameter entity declarations.N(    (   s   selfs   names   pubids   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   new_external_peÀ s   c    s   Ä Å Æ d S(   s   Receives notation declarations.N(    (   s   selfs   names   pubids   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   new_notationÄ s   c    s   È É Ê d S(   s,   Receives the declaration of an element type.N(    (   s   selfs	   elem_names	   elem_cont(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   new_element_typeÈ s   c    s   Ì Í Î d S(   s,   Receives the declaration of a new attribute.N(    (   s   selfs   elems   attrs   a_types   a_decls   a_def(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   new_attributeÌ s   c    s   Ð Ñ Ò d S(   s#   Receives the contents of a comment.N(    (   s   selfs   contents(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   handle_commentÐ s   c    s   Ô Õ Ö d S(   s8   Receives the target and data of processing instructions.N(    (   s   selfs   targets   data(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys	   handle_piÔ s   (   s   __doc__s   __init__s	   dtd_starts   dtd_ends   new_general_entitys   new_external_entitys   new_parameter_entitys   new_external_pes   new_notations   new_element_types   new_attributes   handle_comments	   handle_pi(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   DTDConsumer¤ s   	s   InputSourceFactoryc      s   Ü d  Z  Ý ß d „  Z RS(   s?   A class that creates file-like objects from system identifiers.c    sY   ß à | d d !d j p t i | ƒ d d j o á t | ƒ Sn ã t i | ƒ Sd  S(   Ni   i   s   :\i    s    (   s   sysids   urlparses   opens   urllib2s   urlopen(   s   selfs   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   create_input_sourceß s   1(   s   __doc__s   create_input_source(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   InputSourceFactoryÜ s   	(   s   __doc__s   syss   urllib2s   urlparses   xmlutilss   Applications   PubIdResolvers   ErrorHandlers   EntityHandlers   DTDConsumers   InputSourceFactory(	   s   syss   urlparses   EntityHandlers   DTDConsumers   PubIdResolvers   Applications   InputSourceFactorys   urllib2s   ErrorHandler(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmlapp.pys   ?	 s   
:'8