-
<c       s    d  Z   
 d k Z  d k T d k T d e f d     YZ  d e f d     YZ 
d f  d     YZ ~d	 e f d
     YZ d f  d     YZ	 d f  d     YZ
 d f  d     YZ d f  d     YZ Kd f  d     YZ ~d e f d     YZ d e f d     YZ d   Z d   Z d   Z d   Z d   Z d d  Z -d    Z 1d!   Z @d"   Z Vd#   Z ad$   Z ld%   Z wd&   Z d S('   s  
These are the DTD-aware classes of xmlproc. They provide both the
DTD event consumers for the DTD parser as well as the objects that
store DTD information for retrieval by clients (including the
validating parser).

$Id: xmldtd.py,v 1.18 2002/04/13 19:13:16 larsga Exp $
N(   s   *s   WFCDTDc      sF   d  Z    d   Z  d   Z ' d   Z + d   Z 0 d   Z 5 d   Z 9 d   Z = d   Z B d	   Z	 F d
   Z
 K d   Z O d   Z V d   Z _ d   Z d d   Z o d   Z t d   Z w d   Z z d   Z  d   Z  d   Z  d   Z  d   Z  d   Z  d   Z  d   Z RS(   s*   DTD-representing class for the WFC parser.c    s9     t  i |  |   t  |  |  _  |  i   d  S(   N(   s   DTDConsumers   __init__s   selfs   parsers   dtd_listeners   reset(   s   selfs   parser(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__ s   c    sz      h  |  _  h  |  _  h  |  _   h  |  _ ! h  |  _ $ x. t i   D$ ] } % |  i	 | t |  qR Wd S(   s   Clears all DTD information.N(
   s   selfs   gen_entss
   param_entss   elemss   attrinfos   used_notationss   predef_entss   keyss   names   new_general_entity(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   reset s    	c    s   ' ( ) | |  _ d S(   s6   Registers an object that listens for DTD parse events.N(   s   listeners   selfs   dtd_listener(   s   selfs   listener(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   set_dtd_listener' s   c    s   + - . |  i | Sd S(   s}   Returns the entitiy object associated with this parameter entity
        name. Throws KeyError if the entity is not declared.N(   s   selfs
   param_entss   name(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys
   resolve_pe+ s   c    s   0 2 3 |  i | Sd S(   s{   Returns the entitiy object associated with this general entity
        name. Throws KeyError if the entity is not declared.N(   s   selfs   gen_entss   name(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys
   resolve_ge0 s   c    s   5 6 7 |  i i   Sd S(   s3   Returns the names of all declared general entities.N(   s   selfs   gen_entss   keys(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_general_entities5 s   c    s   9 : ; |  i i   Sd S(   s5   Returns the names of all declared parameter entities.N(   s   selfs
   param_entss   keys(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_parameter_entities9 s   c    s   = ? @ |  i | Sd S(   s_   Returns the declaration of this element. Throws KeyError if the
        element does not exist.N(   s   selfs   elemss   name(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_elem= s   c    s   B C D |  i i   Sd S(   s-   Returns a list of all declared element names.N(   s   selfs   elemss   keys(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_elementsB s   c    s   F H I t  |   d S(   s`   Returns the declaration of the notation. Throws KeyError if the
        notation does not exist.N(   s   KeyErrors   name(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_notationF s   c    s   K L M g  Sd S(   s,   Returns the names of all declared notations.N(    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_notationsK s   c    s   O Q R t  Sd S(   sU   Returns the name of the declared root element, or None if none
        were declared.N(   s   None(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_root_elemO s   c    sn   V W X h  |  _ Y xB |  i i   DY ]. } Z | i   | i   f |  i | i   <q% W] |  i i	   d S(   s   Stores shortcut information.N(
   s   selfs   attrinfos   elemss   valuess   elems   get_default_attributess   get_fixed_attributess   get_names   dtd_listeners   dtd_end(   s   selfs   elem(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   dtd_endV s    	,c    s   _ ` |  i | Sd  S(   N(   s   selfs   attrinfos   name(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_element_info_ s   c    s   d e f |  i i | | | | |  h |  i i	 |  o i t
 |  |  i | <n k |  i | i | | | | |  i  d S(   s,   Receives the declaration of a new attribute.N(   s   selfs   dtd_listeners   new_attributes   elems   attrs   a_types   a_decls   a_defs   elemss   has_keys   ElementTypeAnys   add_attrs   parser(   s   selfs   elems   attrs   a_types   a_decls   a_def(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_attributed s
   c    s   o p |  i i   d  S(   N(   s   selfs   dtd_listeners	   dtd_start(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   dtd_starto s   c    s   t u |  i i |  d  S(   N(   s   selfs   dtd_listeners   handle_comments   contents(   s   selfs   contents(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   handle_commentt s   c    s   w x |  i i | |  d  S(   N(   s   selfs   dtd_listeners	   handle_pis   targets   data(   s   selfs   targets   data(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   handle_piw s   c    s`   z { |  i i |  o } d  Sn  t | |  }  | |  i | < |  i i | |  d  S(   N(	   s   selfs   gen_entss   has_keys   names   InternalEntitys   vals   ents   dtd_listeners   new_general_entity(   s   selfs   names   vals   ent(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_general_entityz s
   c    s`     |  i i |  o  d  Sn  t | |  }  | |  i | < |  i i | |  d  S(   N(	   s   selfs
   param_entss   has_keys   names   InternalEntitys   vals   ents   dtd_listeners   new_parameter_entity(   s   selfs   names   vals   ent(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_parameter_entity s
   c    s     |  i i |  o  d  Sn  | t j o t |  d  o/  |  i i |  o  | |  i | <n n  t	 | | | |  }  | |  i | < |  i i | | | |  d  S(   Ns	   notations(   s   selfs   gen_entss   has_keys   ent_names   ndatas   Nones   hasattrs	   notationss   used_notationss   ExternalEntitys   pubids   sysids   ents   dtd_listeners   new_external_entity(   s   selfs   ent_names   pubids   sysids   ndatas   ent(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_external_entity s    c    si     |  i i |  o  d  Sn  t | | | d  }  | |  i | < |  i i	 | | |  d  S(   Ns    (
   s   selfs
   param_entss   has_keys   names   ExternalEntitys   pubids   sysids   ents   dtd_listeners   new_external_pe(   s   selfs   names   pubids   sysids   ent(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_external_pe s
   c    s     |  i i |  d  S(   N(   s   selfs   dtd_listeners   new_comments   contents(   s   selfs   contents(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_comment s   c    s     |  i i | |  d  S(   N(   s   selfs   dtd_listeners   new_pis   targets   rem(   s   selfs   targets   rem(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_pi s   c    s      |  i i | | |  d  S(   N(   s   selfs   dtd_listeners   new_notations   names   pubids   sysid(   s   selfs   names   pubids   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_notation s   c    s     |  i i | |  d  S(   N(   s   selfs   dtd_listeners   new_element_types	   elem_names	   elem_cont(   s   selfs	   elem_names	   elem_cont(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_element_type s   (   s   __doc__s   __init__s   resets   set_dtd_listeners
   resolve_pes
   resolve_ges   get_general_entitiess   get_parameter_entitiess   get_elems   get_elementss   get_notations   get_notationss   get_root_elems   dtd_ends   get_element_infos   new_attributes	   dtd_starts   handle_comments	   handle_pis   new_general_entitys   new_parameter_entitys   new_external_entitys   new_external_pes   new_comments   new_pis   new_notations   new_element_type(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   WFCDTD s6   					s   CompleteDTDc      sz    d  Z    d   Z  d   Z  d   Z  d   Z  d   Z  d   Z  d   Z  d   Z  d	   Z	 RS(
   s/   Complete DTD handler for the validating parser.c    s     t  i |  |  d  S(   N(   s   WFCDTDs   __init__s   selfs   parser(   s   selfs   parser(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__ s   c    sJ      t  i |    h  |  _  h  |  _  t |  _  h  |  _ d S(   s   Clears all DTD information.N(   s   WFCDTDs   resets   selfs	   notationss   attlistss   Nones	   root_elems   cmhash(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   reset s   c    s      |  i Sd S(   s.   Returns the name of the declared root element.N(   s   selfs	   root_elem(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_root_elem s   c    s      |  i | Sd S(   s`   Returns the declaration of the notation. Throws KeyError if the
        notation does not exist.N(   s   selfs	   notationss   name(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_notation s   c    s      |  i i   Sd S(   s,   Returns the names of all declared notations.N(   s   selfs	   notationss   keys(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_notations s   c    s     t  i |    h  |  _  x0 |  i i   D ] }  |  i i d |  q2 W h  |  _  xm |  i	 i   D ]Y }  y  |  i |  Wn9  t j
 o*  |  i i d |  i	 | | f  n Xqt W h  |  _	 d  S(   Ni  i  (   s   WFCDTDs   dtd_ends   selfs   cmhashs   attlistss   keyss   elems   parsers   report_errors   used_notationss   notations   get_notations   KeyError(   s   selfs   elems   notation(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   dtd_end s    	 	,c    s6     | | f |  i | < |  i i | | |  d  S(   N(   s   pubids   sysids   selfs	   notationss   names   dtd_listeners   new_notation(   s   selfs   names   pubids   sysid(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_notation s   c    s    |  i i |  o!  |  i i d |   d  Sn  | d j o8  d g  d f }  t | t    |  |  i | <nk  | d j o#  t	 }  t
 |  |  i | <n8  t |  i | |  i  }  t | | |  |  i | < |  i i |  od  xM |  i | D ]; \ } } } }  |  i | i | | | |  |  i  qW |  i | =n  |  i i | |  d  S(   Ni  s   EMPTYs    s   ANY(   s   selfs   elemss   has_keys	   elem_names   parsers   report_errors	   elem_conts   ElementTypes   make_empty_models   Nones   ElementTypeAnys
   make_models   cmhashs   models   attlistss   attrs   a_types   a_decls   a_defs   add_attrs   dtd_listeners   new_element_type(   s   selfs	   elem_names	   elem_conts   a_types   a_decls   models   a_defs   attr(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_element_type s&   	 c    s      |  i i | | | | |   y*  |  i | i	 | | | | |  i
  Wnx  t j
 oi y' |  i | i | | | | f  Wn5 t j
 o& | | | | f g |  i | <n Xn Xd S(   s,   Receives the declaration of a new attribute.N(   s   selfs   dtd_listeners   new_attributes   elems   attrs   a_types   a_decls   a_defs   elemss   add_attrs   parsers   KeyErrors   attlistss   append(   s   selfs   elems   attrs   a_types   a_decls   a_def(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_attribute s   *'(
   s   __doc__s   __init__s   resets   get_root_elems   get_notations   get_notationss   dtd_ends   new_notations   new_element_types   new_attribute(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   CompleteDTD s   	s   ElementTypec      s   
d  Z  d   Z d   Z d   Z d   Z !d   Z 9d   Z =d   Z Ad   Z Id	   Z	 Xd
   Z
 dd   Z ld   Z td   Z RS(   s   Represents an element type.c    sC   | |  _  h  |  _ g  |  _ | |  _ | |  _ d  S(   N(   s   names   selfs   attrhashs   attrlists   compileds   content_models   originals   content_model_structure(   s   selfs   names   compileds   original(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__s
   c    s   |  i Sd S(   s%   Returns the name of the element type.N(   s   selfs   name(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_names   c    s   |  i Sd S(   sa   Returns a list of the declared attribute names in the order the
        attributes were declared.N(   s   selfs   attrlist(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_attr_lists   c    s   |  i | Sd S(   s@   Returns the attribute or throws a KeyError if it's not declared.N(   s   selfs   attrhashs   name(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_attrs   c    s  !"#|  i i |  o $| i d |  %d Sn '|  i i |  )| d j o *xH |  i i	   D*]4 } +|  i | i d j o ,| i d  n qp W.| d j o
 | d j o /| i d  n n] 0t |  t i j o | d d	 j o2 1x( | d
 D1] } 2| | i i | <qWn 4t | | | | |  |  i | <6| t j o( 7|  i | i |  i | i |  n d S(   s$   Adds a new attribute to the element.i  Ns   IDi  s	   #REQUIREDs   #IMPLIEDi  i    s   NOTATIONi   (   s   selfs   attrhashs   has_keys   attrs   parsers   report_errors   attrlists   appends   a_types   keyss	   attr_names   types   a_decls   typess	   TupleTypes   notations   dtds   used_notationss	   Attributes   a_defs   Nones   validates   default(   s   selfs   attrs   a_types   a_decls   a_defs   parsers   notations	   attr_name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   add_attr!s&    	* 	"c    s   9:;|  i d Sd S(   s-   Return the start state of this content model.s   startN(   s   selfs   content_model(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_start_state9s   c    s   =>?|  i d | @Sd S(   s!   True if 'state' is a final state.s   finalN(   s   selfs   content_models   state(   s   selfs   state(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   final_state=s   c    s$   AEG|  i | i | d  Sd S(   s   Returns the next state of the content model from the given one
        when elem_name is encountered. Character data is represented as
        '#PCDATA'. If 0 is returned the element is not allowed here or if
        the state is unknown.i    N(   s   selfs   content_models   states   gets	   elem_name(   s   selfs   states	   elem_name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys
   next_stateAs   c    s~   IPR|  i | } Sx^ | i   DS]M } T|  i | | i |  o) U|  i | | } V| | | f Sn q& Wd S(   s  Assumes that one element has been forgotten and tries to
        skip forward one state (regardless of what element is attached
        to the transition) to get to a state where elem_name is
        legal. Returns a (state, elem) tuple, where elem is the
        element missing, and state is the state reached by following
        the elem_name arc after using the missing element. None is
        returned if no missing element can be found.N(	   s   selfs   content_models   states   arcss   keyss   skippeds   has_keys	   elem_names   arcs2(   s   selfs   states	   elem_names   skippeds   arcss   arcs2(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   next_state_skipIs    	c    sc   X[\|  i t j o ]g  Sn _y `|  i | i   SWn at j
 o bg  Sn Xd S(   s   Returns a list of the valid elements in the given state, or the
        empty list if none are valid (or if the state is unknown). If the
        content model is ANY, the empty list is returned.N(   s   selfs   content_models   Nones   states   keyss   KeyError(   s   selfs   state(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_valid_elementsXs   c    s   dgh|  i Sd S(   s   Returns the element content model in (sep,cont,mod) format, where
        cont is a list of (name,mod) and (sep,cont,mod) tuples. ANY content
        models are represented as None, and EMPTYs as ("",[],"").N(   s   selfs   content_model_structure(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_content_modelds   c    sj   lmh  } nxM |  i i   Dn]9 } o| i   t j o p| i   | | i   <n q Wr| Sd  S(   N(   s   defss   selfs   attrhashs   valuess   attrs   get_defaults   Nones   get_name(   s   selfs   defss   attr(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_default_attributesls   	 	!c    sj   tuh  } vxM |  i i   Dv]9 } w| i   d j o x| i   | | i   <n q Wz| Sd  S(   Ns   #FIXED(   s   fixeds   selfs   attrhashs   valuess   attrs   get_decls   get_defaults   get_name(   s   selfs   fixeds   attr(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_fixed_attributests   	 	!(   s   __doc__s   __init__s   get_names   get_attr_lists   get_attrs   add_attrs   get_start_states   final_states
   next_states   next_state_skips   get_valid_elementss   get_content_models   get_default_attributess   get_fixed_attributes(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   ElementType
s   	s   ElementTypeAnyc      sA   ~d   Z  d   Z d   Z d   Z d   Z RS(   Nc    s    t  i |  | t t  d  S(   N(   s   ElementTypes   __init__s   selfs   names   None(   s   selfs   name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__s   c    s   d Sd  S(   Ni   (    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_start_states   c    s   d Sd  S(   Ni   (    (   s   selfs   state(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   final_states   c    s   d Sd  S(   Ni   (    (   s   selfs   states	   elem_name(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys
   next_states   c    s   g  Sd  S(   N(    (   s   selfs   state(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_valid_elementss   (   s   __init__s   get_start_states   final_states
   next_states   get_valid_elements(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   ElementTypeAny~s
   s	   Attributec      sV   d  Z  d   Z d   Z d   Z d   Z d   Z d   Z RS(   s    Represents a declared attribute.c    sa  | |  _  | |  _ | |  _ | t j o |  i d j o" t i t i	 |   |  _ n | |  _ | d j o d } t |  i  t j o | i d  d  Sn t |  i  d j  p t |  i  d j o d } n> x7 |  i D]) } | d d g j o d } n qW| o | i d	  n n d  S(
   Ns   CDATAs	   xml:spacei    i  i   i   s   defaults   preservei  (   s   names   selfs   attrtypes   types   decls   defaults   Nones   strings   joins   splits   errors   StringTypess   parsers   report_errors   lens   alt(   s   selfs   names   attrtypes   decls   defaults   parsers   errors   alt(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__s&    "	/ 	
c    s   t  |  i   t j oU x/ |  i  D]! } | | j o d Sn q, W| i d | |  i f  n|  i  d j o d Snk|  i  d j p |  i  d j p |  i  d j o2 t t	 |  o | i d |  i  n n|  i  d j o2 t t
 |  o | i d	 |  i  n n |  i  d
 j o2 t t |  o | i d |  i  n n| |  i  d j p |  i  d j oX xN t i |  D]: } t t	 |  o  | i d | |  i f  n qWn d S(   s&   Validates given value for correctness.Ni  s   CDATAs   IDs   IDREFs   ENTITIYi  s   NMTOKENi  s   NMTOKENSi  s   IDREFSs   ENTITIESi  (   s   types   selfs   StringTypess   vals   values   parsers   report_errors   names   matchess   reg_names   reg_nmtokens   reg_nmtokenss   strings   splits   token(   s   selfs   values   parsers   vals   token(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   validates.    	  3# 	c    s   |  i Sd S(   s   Returns the attribute name.N(   s   selfs   name(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_names   c    s   |  i Sd S(   s2   Returns the type of the attribute. (ID, CDATA etc)N(   s   selfs   type(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_types   c    s   |  i Sd S(   sB   Returns the declaration (#IMPLIED, #REQUIRED, #FIXED or #DEFAULT).N(   s   selfs   decl(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_decls   c    s   |  i Sd S(   sV   Returns the default value of the attribute, or None if none has
        been declared.N(   s   selfs   default(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_defaults   (   s   __doc__s   __init__s   validates   get_names   get_types   get_decls   get_default(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   Attributes   	s   InternalEntityc      s)   d   Z  d   Z d   Z RS(   Nc    s   | |  _  | |  _ d  S(   N(   s   names   selfs   value(   s   selfs   names   value(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__s   c    s   d Sd  S(   Ni   (    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   is_internals   c    s   |  i Sd S(   s+   Returns the replacement text of the entity.N(   s   selfs   value(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   get_values   (   s   __init__s   is_internals	   get_value(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   InternalEntitys   s   ExternalEntityc      sM   d   Z  d   Z d   Z d   Z d   Z d   Z RS(   Nc    s7   | |  _  | |  _ | |  _ | |  _ d  S(   N(   s   names   selfs   pubids   sysids   notation(   s   selfs   names   pubids   sysids   notation(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__s   c    s   |  i d j Sd S(   s    True if this is a parsed entity.s    N(   s   selfs   notation(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   is_parseds   c    s   d Sd  S(   Ni    (    (   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   is_internals   c    s   |  i Sd S(   s,   Returns the public identifier of the entity.N(   s   selfs   pubid(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   get_pubids   c    s    |  i Sd S(   s,   Returns the system identifier of the entity.N(   s   selfs   sysid(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   get_sysids   c    s   |  i Sd S(   s=   Returns the notation of the entity, or None if there is none.N(   s   selfs   notation(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_notations   (   s   __init__s	   is_parseds   is_internals	   get_pubids	   get_sysids   get_notation(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   ExternalEntitys   s   FNDABuilderc      s   d  Z  d   Z d   Z d   Z d   Z "d   Z 'd   Z +d   Z /d   Z 3d	   Z	 ;d
   Z
 @d   Z Ed   Z RS(   s,   Builds a finite non-deterministic automaton.c    s.   d |  _ g  g |  _ g  |  _ d  S(   Ni    (   s   selfs   _FNDABuilder__currents   _FNDABuilder__transitionss   _FNDABuilder__mem(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__s   c    s    |  i i |  i  d S(   s-   Makes the builder remember the current state.N(   s   selfs   _FNDABuilder__mems   appends   _FNDABuilder__current(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   remember_states   c    s   |  i d |  _ d S(   sb   Makes the current state the last remembered one. The last remembered
        one is not forgotten.iN(   s   selfs   _FNDABuilder__mems   _FNDABuilder__current(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   set_current_to_remembereds   c    s    |  i d =d S(   s6   Makes the builder forget the current remembered state.iN(   s   selfs   _FNDABuilder__mem(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   forget_states   c    s6   "#$|  i i g   %t |  i  d |  _ d S(   s6   Creates a new last state and makes it the current one.i   N(   s   selfs   _FNDABuilder__transitionss   appends   lens   _FNDABuilder__current(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys	   new_state"s   c    s   '()|  i Sd S(   s.   Returns the automaton produced by the builder.N(   s   selfs   _FNDABuilder__transitions(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_automaton's   c    s   +,-|  i Sd S(   s   Returns the current state.N(   s   selfs   _FNDABuilder__current(   s   self(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   get_current_state+s   c    s'   /01|  i | i | | f  d S(   s4   Creates a new transition from frm to to, over label.N(   s   selfs   _FNDABuilder__transitionss   frms   appends   tos   label(   s   selfs   labels   frms   to(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_transition/s   c    sX   356|  i   7|  i   8|  i |  i d i |  i | f  9|  i   d S(   sl   Creates a new transition from the current state to a new state,
        which becomes the new current state.iN(	   s   selfs   remember_states	   new_states   _FNDABuilder__transitionss   _FNDABuilder__mems   appends   _FNDABuilder__currents   labels   forget_state(   s   selfs   label(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_transition_to_new3s
   'c    s1   ;=>|  i |  i i |  i d | f  d S(   sR   Adds a new transition from the current state to the last remembered
        state.iN(   s   selfs   _FNDABuilder__transitionss   _FNDABuilder__currents   appends   _FNDABuilder__mems   label(   s   selfs   label(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_transition_cur2rem;s   c    s1   @BC|  i |  i d i |  i | f  d S(   sS   Creates a new transition from the current state to the last
        remembered one.iN(   s   selfs   _FNDABuilder__transitionss   _FNDABuilder__mems   appends   _FNDABuilder__currents   label(   s   selfs   label(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_transition_rem2cur@s   c    s*   EFG|  i | i |  i | f  d S(   s?   Creates a new transition from frm to current state, with label.N(   s   selfs   _FNDABuilder__transitionss   frms   appends   _FNDABuilder__currents   label(   s   selfs   frms   label(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   new_transition_2curEs   (   s   __doc__s   __init__s   remember_states   set_current_to_remembereds   forget_states	   new_states   get_automatons   get_current_states   new_transitions   new_transition_to_news   new_transition_cur2rems   new_transition_rem2curs   new_transition_2cur(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   FNDABuilders   	s   ContentModelc      s5   Kd  Z  LNd   Z Rd   Z hd d  Z RS(   s1   Represents a singleton content model. (Internal.)c    s   NO| |  _  P| |  _ d  S(   N(   s   contentss   selfs   modifier(   s   selfs   contentss   modifier(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   __init__Ns   c    s0  RST|  i d j o> U| i   V|  i |  W| i d  X| i   n Y|  i d j oN Z|  i |  [| i   \|  i | d  ]| i   ^| i   nu _|  i d j oQ `| i   a| i d  b|  i | d  c| i d  d| i   n f|  i |  d S(   sB   Builds the part of the automaton corresponding to this model part.s   ?s    s   +i   s   *N(	   s   selfs   modifiers   builders   remember_states   add_contentss   new_transition_rem2curs   forget_states   set_current_to_remembereds   new_transition_to_new(   s   selfs   builder(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys
   add_statesRs&   i    c    s   hjkt  |  i d  t i j ow l| oR m| i   n|  i d i |  o| i	 d  p| i
   q| i   n s|  i d i |  nU u| o3 v| i |  i d w| i   x| i    n z| i |  i d  d S(   s   Adds the states and transitions belonging to the self.contents
        parts. If loop is true the states will loop back to the first state.i    s    N(   s   types   selfs   contentss   typess   InstanceTypes   loops   builders   remember_states
   add_statess   new_transition_cur2rems   set_current_to_remembereds   forget_states   new_transitions   get_current_states   new_transition_to_new(   s   selfs   builders   loop(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   add_contentshs    

(   s   __doc__s   __init__s
   add_statess   add_contents(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   ContentModelKs   	s   SeqContentModelc      s   ~d  Z  d d  Z RS(   s2   Represents a sequential content model. (Internal.)i    c    sw   | o | i   n x$ |  i D] } | i |  q+ W| o! | i d  | i   n d  S(   Ns    (	   s   loops   builders   remember_states   selfs   contentss   cps
   add_statess   new_transition_cur2rems   forget_state(   s   selfs   builders   loops   cp(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   add_contentss   
 	
(   s   __doc__s   add_contents(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   SeqContentModel~s   	s   ChoiceContentModelc      s   d  Z  d d  Z RS(   s.   Represents a choice content model. (Internal.)i    c    s   | i   g  } xW |  i D]I } | i   | i d  | i |  | i	 | i
    q& W| i   x$ | D] } | i | d  q W| o | i d  n | i   d  S(   Ns    (   s   builders   remember_states
   end_statess   selfs   contentss   cps	   new_states   new_transition_rem2curs
   add_statess   appends   get_current_states   states   new_transition_2curs   loops   new_transition_cur2rems   forget_state(   s   selfs   builders   loops   states
   end_statess   cp(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   add_contentss   	 	
 	
(   s   __doc__s   add_contents(    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   ChoiceContentModels   	c    sb   d } d } x9 |  D]. } | o | | } n | d } q" W| Sd S(   s.   Creates a hash number from the included array.i    l    l    N(   s   nos   exps   includeds   state(   s   includeds   states   exps   no(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   hashs   		
 	
c 	   s  |  i g   h  } h  } d g t |   } t d | |   t |  } | | d <t	 d |  | | | | |  | i   } | i   x: | D]/ } | d d j o | | d <Pn q Wt d |  | d <| Sd S(   sQ   Converts a finite-state non-deterministic automaton into a deterministic
    one.i    i   i   s   startl    s   finalN(   s   transitionss   appends
   new_statess   closure_hashs   lens   start_states   compute_closures   hashs	   state_keys   add_transitionss   parsers   keyss   statess   sorts   states   pows   final_state(	   s   transitionss   final_states   parsers   statess   start_states   closure_hashs   states	   state_keys
   new_states(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   fnda2fdas&   			

 	c  	  s  h  | | <h  } d } x | D] } | ot xj | | D][ \ } } | d j o? | i	 |  o | | i
 |  n | g | | <n qP Wn | d } q/ Wx!| i   D]\ } } t |  d j o | i	 | d  o | | d }
 n{ d g t |  }	 x$ | D] } t | |	 |  qEWt |	  }
 t |  d j o |
 | | d <n |
 | | | <| i	 |
  o& t | | | |	 	|
 | |  n q Wd S(   s)   Set up transitions and create new states.i    s    i   N(   s
   new_statess	   state_keys	   new_transs   nos   cur_state_lists	   old_states   transitionss   tos   whats   has_keys   appends   itemss   overs   destlists   lens   closure_hashs	   new_states   new_incs   compute_closures   hashs   add_transitionss   parser(   s   ixs   transitionss
   new_statess   cur_state_lists	   state_keys   parsers   closure_hashs   whats   overs   new_incs	   new_states   nos	   new_transs   tos	   old_states   destlist(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   add_transitionss:   		
 	
  *
 	c    sk   d | |  <xN | |  D]? \ } } | d j o	 | | o t | | |  n q! Wd S(   s%   Computes the e-closure of this state.i   s    N(   s   includeds   ixs   transitionss   tos   whats   compute_closure(   s   ixs   includeds   transitionss   whats   to(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   compute_closures    c    sm   d } xW |  D]L } d | GHx | D] } d | GHq5 W| d } t   q Wd  S(   Ni    s	   STATE: %ds     TO %d OVER %si   (   s   ixs   models   transitionss   steps	   raw_input(   s   models   ixs   transitionss   step(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   print_transs   	
 	
 	i    c    s  t  o( |  i d  p |  i d  p t  x |  i   D] } |  | }  d | GH!xY | D!]N \ } } "y #d | d | GHWn# $t	 j
 o %d | GHn Xqr W'| d j o (t   n qE W*| o +t   n d  S(   Ns   starts   finals   State: s     To: s    over: s   ERROR: i   (   s	   __debug__s   statess   has_keys   AssertionErrors   keyss	   trans_keys   transs   tos   whats	   TypeErrors   stops	   raw_input(   s   statess   stops   tos   whats	   trans_keys   trans(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   print_statess   2 	
 
c      s,   -./h  h  d <d d <d d <Sd S(   s2   Constructs a state model for empty content models.i   s   finals   startN(    (    (    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   make_empty_model-s   c    s   123| } 4|  i |  o 5|  | Sng 7t |  } 8t   } 9| i |  :t | i	   ;| i
   <|  } =| |  | <>| Sd S(   s&   Creates an FDA from the content model.N(   s   content_models   cms   cmhashs   has_keys   make_objectss   FNDABuilders   builders
   add_statess   fnda2fdas   get_automatons   get_current_states   err(   s   cmhashs   content_models   errs   cms   builder(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys
   make_model1s   
c    s!  @AB|  \ } } } C| d d d j o Dd } n Fg  } Gxe | DG]Z } Ht |  d j o( I| i t | d g | d   n K| i t	 |   qP WM| d j o Nt
 | |  SnI O| d j o Pt | |  Sn% Q| d j o Rt | |  Sn d	 S(
   s;   Turns a tuple-ized content model into one based on objects.i    s   #PCDATAs   *i   i   s   ,s   |s    N(   s   content_models   seps   contentss   mods   newcontss   tups   lens   appends   ContentModels   make_objectss   SeqContentModels   ChoiceContentModel(   s   content_models   seps   tups   newcontss   contentss   mod(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   make_objects@s    	
 	(c    s   VWXd k  } d k } Z| i   } [| i | i |   \|  d | _ ]t | i  | _	 ^d | _
 _t h  | i   |  Sd S(   sB   Parses a content model string, returning a compiled content model.Ni   (   s	   dtdparsers   utilss	   DTDParsers   ps   set_error_handlers   ErrorPrinters   cms   datas   lens   datasizes   finals
   make_models   _parse_content_model(   s   cms   ps	   dtdparsers   utils(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   compile_content_modelVs   c    s   abcd k  } d k } e| i   } f| i | i |   g|  d | _ ht | i  | _	 id | _
 j| i   Sd S(   sB   Parses a content model string, returning a compiled content model.Ni   (   s	   dtdparsers   utilss	   DTDParsers   ps   set_error_handlers   ErrorPrinters   cms   datas   lens   datasizes   finals   _parse_content_model(   s   cms	   dtdparsers   ps   utils(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   parse_content_modelas   c    sz   lmd  k  } d  k } o| i   } p| i | i |   qt |  } r| i |  s| i	 |   u| Sd  S(   N(   s	   dtdparsers   utilss	   DTDParsers   dps   set_error_handlers   ErrorPrinters   CompleteDTDs   dtds   set_dtd_consumers   parse_resources   sysid(   s   sysids	   dtdparsers   utilss   dps   dtd(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   load_dtdls   c    sz   wxd  k  } d  k } z| i   } {| i | i |   |t |  } }| i |  ~| i	 |   | Sd  S(   N(   s	   dtdparsers   utilss	   DTDParsers   dps   set_error_handlers   ErrorPrinters   CompleteDTDs   dtds   set_dtd_consumers   parse_strings   dtdstr(   s   dtdstrs	   dtdparsers   utilss   dps   dtd(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   load_dtd_stringws   (   s   __doc__s   typess   xmlutilss   xmlapps   DTDConsumers   WFCDTDs   CompleteDTDs   ElementTypes   ElementTypeAnys	   Attributes   InternalEntitys   ExternalEntitys   FNDABuilders   ContentModels   SeqContentModels   ChoiceContentModels   hashs   fnda2fdas   add_transitionss   compute_closures   print_transs   print_statess   make_empty_models
   make_models   make_objectss   compile_content_models   parse_content_models   load_dtds   load_dtd_string(   s   ElementTypeAnys   hashs   load_dtds   WFCDTDs   FNDABuilders   ContentModels   make_objectss   load_dtd_strings   CompleteDTDs   compile_content_models   ElementTypes   InternalEntitys
   make_models   add_transitionss   fnda2fdas	   Attributes   make_empty_models   print_transs   compute_closures   ChoiceContentModels   print_statess   typess   SeqContentModels   parse_content_models   ExternalEntity(    (    sM   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/xmldtd.pys   ? s6   

XtL!>3&2	