-
<c       s    d  Z    d k Z d k Z d k Z d k Z 	 e i Z  e i d  d j o  d k l Z n  y  d k	 l
 Z
 Wn$  e j
 o Z  d   Z
 n X d e f d     YZ  d	 e i f d
     YZ 6 d e i f d     YZ J d e i f d     YZ a d e i f d     YZ v d e i f d     YZ  d   Z  d   Z  d e i f d     YZ  d e i f d     YZ  d f  d     YZ  d   Z  d   Z d S(   s\   
Some utilities for use with xmlproc.

$Id: utils.py,v 1.7 2002/05/01 09:02:37 loewis Exp $
Ni   s   java(   s	   Exception(   s   EncodedFilec    s     |  Sd  S(   N(   s   file(   s   files   encoding(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   EncodedFile s   s   XMLParseExceptionc      s     RS(   N(    (    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   XMLParseException s   s   ErrorPrinterc      sS    d  Z     d e i d  Z % d   Z ) d   Z - d   Z 0 d   Z RS(   s2   An error handler that prints out warning messages.i    c    s5     ! t  i i |  |  " | |  _ # | |  _ d  S(   N(   s   xmlapps   ErrorHandlers   __init__s   selfs   locators   levels   out(   s   selfs   locators   levels   out(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__  s   c    sA   % & |  i d j  o' ' |  i i d | |  i   f  n d  S(   Ni   s   WARNING: %s at %s
(   s   selfs   levels   outs   writes   msgs   _ErrorPrinter__get_location(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   warning% s   c    sA   ) * |  i d j  o' + |  i i d | |  i   f  n d  S(   Ni   s   ERROR: %s at %s
(   s   selfs   levels   outs   writes   msgs   _ErrorPrinter__get_location(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   error) s   c    s*   - . |  i i d | |  i   f  d  S(   Ns   ERROR: %s at %s
(   s   selfs   outs   writes   msgs   _ErrorPrinter__get_location(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   fatal- s   c    s6   0 1 d |  i i   |  i i   |  i i   f Sd  S(   Ns   %s:%d:%d(   s   selfs   locators   get_current_sysids   get_lines
   get_column(   s   self(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __get_location0 s   (   s   __doc__s   syss   stderrs   __init__s   warnings   errors   fatals   _ErrorPrinter__get_location(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   ErrorPrinter s   	s   ErrorRaiserc      sD   6 d  Z  7 9 e d d  Z = d   Z A d   Z E d   Z RS(   s(   An error handler that raises exceptions.i    c    s)   9 : t  i i |  |  ; | |  _ d  S(   N(   s   xmlapps   ErrorHandlers   __init__s   selfs   locators   level(   s   selfs   locators   level(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__9 s   c    s-   = > |  i d j  o ? t |   n d  S(   Ni   (   s   selfs   levels   XMLParseExceptions   msg(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   warning= s   c    s-   A B |  i d j  o C t |   n d  S(   Ni   (   s   selfs   levels   XMLParseExceptions   msg(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   errorA s   c    s   E F t  |   d  S(   N(   s   XMLParseExceptions   msg(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   fatalE s   (   s   __doc__s   Nones   __init__s   warnings   errors   fatal(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   ErrorRaiser6 s
   	s   ErrorCounterc      sM   J d  Z  K M e d  Z Q d   Z V d   Z Y d   Z \ d   Z RS(   s$   An error handler that counts errors.c    s*   M N t  i i |  |  O |  i   d  S(   N(   s   xmlapps   ErrorHandlers   __init__s   selfs   locators   reset(   s   selfs   locator(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__M s   c    s+   Q R d |  _ S d |  _ T d |  _ d  S(   Ni    (   s   selfs   warningss   errorss   fatals(   s   self(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   resetQ s   c    s   V W |  i d |  _ d  S(   Ni   (   s   selfs   warnings(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   warningV s   c    s   Y Z |  i d |  _ d  S(   Ni   (   s   selfs   errors(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   errorY s   c    s   \ ] |  i d |  _ d  S(   Ni   (   s   selfs   fatals(   s   selfs   msg(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   fatal\ s   (   s   __doc__s   Nones   __init__s   resets   warnings   errors   fatal(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   ErrorCounterJ s   	s   ESISDocHandlerc      sG   a c e  i d  Z f d   Z i d   Z n d   Z q d   Z RS(   Nc    s   c d | |  _  d  S(   N(   s   writers   self(   s   selfs   writer(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__c s   c    s*   f g |  i i d | d | d  d  S(   Ns   ?s    s   
(   s   selfs   writers   writes   targets   data(   s   selfs   targets   data(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys	   handle_pif s   c    sf   i j |  i i d | d  k x> | i   Dk ]- } l |  i i d | d | | d  q. Wd  S(   Ns   (s   
s   As    (   s   selfs   writers   writes   names   amaps   keyss   a_name(   s   selfs   names   amaps   a_name(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_start_tagi s    	c    s"   n o |  i i d | d  d  S(   Ns   )s   
(   s   selfs   writers   writes   name(   s   selfs   name(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_end_tagn s   c    s)   q r |  i i d | | | !d  d  S(   Ns   -s   
(   s   selfs   writers   writes   datas   start_ixs   end_ix(   s   selfs   datas   start_ixs   end_ix(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_dataq s   (   s   syss   stdouts   __init__s	   handle_pis   handle_start_tags   handle_end_tags   handle_data(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   ESISDocHandlera s
   s	   Canonizerc      s_   v x e  i d  Z | d   Z  d   Z  d   Z  d   Z  d   Z  d   Z RS(   Nc    s   x y d |  _ z | |  _ d  S(   Ni    (   s   selfs
   elem_levels   writer(   s   selfs   writer(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__x s   c    s>   | } | d j o' ~ |  i i d | d | d  n d  S(   Ns   xmls   <?s    s   ?>(   s   targets   selfs   writers   writes	   remainder(   s   selfs   targets	   remainder(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys	   handle_pi| s   c    s     |  i i d |   | i   }  | i    xS | D ]H }  |  i i d | d   |  i	 | |   |  i i d  q@ W |  i i d   |  i
 d |  _
 d  S(   Ns   <s    s   ="s   "s   >i   (   s   selfs   writers   writes   names   amaps   keyss   a_namess   sorts   a_names
   write_datas
   elem_level(   s   selfs   names   amaps   a_namess   a_name(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_start_tag s   
 	c    s5     |  i i d | d   |  i d |  _ d  S(   Ns   </s   >i   (   s   selfs   writers   writes   names
   elem_level(   s   selfs   name(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_end_tag s   c    s     |  i | | | ! d  S(   N(   s   selfs
   write_datas   datas   start_ixs   end_ix(   s   selfs   datas   start_ixs   end_ix(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_ignorable_data s   c    s5     |  i d j o  |  i | | | ! n d  S(   Ni    (   s   selfs
   elem_levels
   write_datas   datas   start_ixs   end_ix(   s   selfs   datas   start_ixs   end_ix(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_data s   c    s     t  | d d  }  t  | d d  }  t  | d d  }  t  | d d  }  t  | t d	  d
  }  t  | t d  d  }  t  | t d  d  }  |  i i |  d  S(   Ns   &s   &amp;s   <s   &lt;s   "s   &quot;s   >s   &gt;i	   s   &#9;i
   s   &#10;i   s   &#13;(   s   replaces   datas   chrs   selfs   writers   write(   s   selfs   data(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys
   write_data s   (	   s   syss   stdouts   __init__s	   handle_pis   handle_start_tags   handle_end_tags   handle_ignorable_datas   handle_datas
   write_data(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys	   Canonizerv s   c    s&     t  t  |  d d  d d  Sd  S(   Ns   &s   &amp;s   <s   &lt;(   s   replaces   str(   s   str(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   escape_content s   c    s5     t  t  t  |  d d  d d  d  d  Sd  S(   Ns   &s   &amp;s   <s   &lt;s   "s   &quot;(   s   replaces   str(   s   str(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   escape_attval s   $s   DocGeneratorc      sP     e  d  Z  d   Z  d   Z  d   Z  d   Z  d   Z RS(   Nc    s:     | o  t t i d  |  _  n  | |  _  d  S(   Ns   utf-8(   s   outs   EncodedFiles   syss   stdouts   self(   s   selfs   out(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__ s   c    s$     |  i i d | | f  d  S(   Ns	   <?%s %s?>(   s   selfs   outs   writes   targets	   remainder(   s   selfs   targets	   remainder(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys	   handle_pi s   c    sw     |  i i d |   x@ | i   D ]/ \ } }  |  i i d | t |  f  q* W |  i i d  d  S(   Ns   <s    %s="%s"s   >(   s   selfs   outs   writes   names   amaps   itemss   values   escape_attval(   s   selfs   names   amaps   value(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_start_tag s
    'c    s     |  i i d |  d  S(   Ns   </%s>(   s   selfs   outs   writes   name(   s   selfs   name(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_end_tag s   c    s'     |  i i t | | | !  d  S(   N(   s   selfs   outs   writes   escape_contents   datas   start_ixs   end_ix(   s   selfs   datas   start_ixs   end_ix(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_ignorable_data s   c    s'     |  i i t | | | !  d  S(   N(   s   selfs   outs   writes   escape_contents   datas   start_ixs   end_ix(   s   selfs   datas   start_ixs   end_ix(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   handle_data s   (   s   Nones   __init__s	   handle_pis   handle_start_tags   handle_end_tags   handle_ignorable_datas   handle_data(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   DocGenerator s   s   DictResolverc      s8     e  d  Z  d   Z  d   Z  d   Z RS(   Nc    s0     | t j o  h  } n  | |  _  d  S(   N(   s   mappings   Nones   self(   s   selfs   mapping(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__ s   c    s     |  i i | |  Sd  S(   N(   s   selfs   mappings   gets   pubids   sysid(   s   selfs   pubids   sysid(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   resolve_pe_pubid s   c    s     |  i i | |  Sd  S(   N(   s   selfs   mappings   gets   pubids   sysid(   s   selfs   pubids   sysid(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   resolve_doctype_pubid s   c    s     |  i i | |  Sd  S(   N(   s   selfs   mappings   gets   pubids   sysid(   s   selfs   pubids   sysid(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   resolve_entity_pubid s   (   s   Nones   __init__s   resolve_pe_pubids   resolve_doctype_pubids   resolve_entity_pubid(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   DictResolver s   s   Locationc      sA     d   Z   d   Z  d   Z  d   Z  d   Z RS(   Nc    s=     | i   |  _  | i   |  _  | i   |  _ d  S(   N(   s   locators   get_current_sysids   selfs   _sysids   get_lines   _lines
   get_columns   _column(   s   selfs   locator(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __init__ s   c    s     |  i Sd  S(   N(   s   selfs   _sysid(   s   self(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys	   get_sysid s   c    s     |  i Sd  S(   N(   s   selfs   _line(   s   self(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   get_line s   c    s     |  i Sd  S(   N(   s   selfs   _column(   s   self(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys
   get_column s   c    s$     d |  i |  i |  i f Sd  S(   Ns   %s:%s:%s(   s   selfs   _sysids   _lines   _column(   s   self(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   __str__ s   (   s   __init__s	   get_sysids   get_lines
   get_columns   __str__(    (    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   Location s
   c    sd     d  k  } d  k }  | i   }  | i |  }  | i |   | i |    | Sd  S(   N(	   s	   dtdparsers   xmldtds	   DTDParsers   dps   CompleteDTDs   dtds   set_dtd_consumers   parse_resources   sysid(   s   sysids	   dtdparsers   xmldtds   dps   dtd(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   load_dtd s   c    sT     d  k  }  | i   }  |  | _  | i t |    | i |  d  S(   N(   s   xmlvals   XMLValidators   parsers   dtds   set_error_handlers   ErrorPrinters   parse_resources   sysid(   s   dtds   sysids   parsers   xmlval(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   validate_doc s
   (   s   __doc__s   xmlapps   syss   strings   typess   replaces   platforms	   java.langs	   Exceptions   codecss   EncodedFiles   ImportErrors   es   XMLParseExceptions   ErrorHandlers   ErrorPrinters   ErrorRaisers   ErrorCounters   Applications   ESISDocHandlers	   Canonizers   escape_contents   escape_attvals   DocGenerators   PubIdResolvers   DictResolvers   Locations   load_dtds   validate_doc(   s	   Exceptions   load_dtds   DictResolvers   xmlapps   replaces   syss   Locations   typess   strings   es   EncodedFiles   ESISDocHandlers   ErrorPrinters   ErrorRaisers	   Canonizers   validate_docs   XMLParseExceptions   escape_attvals   DocGenerators   ErrorCounters   escape_content(    (    sL   /usr/local/twc/lib/python2.2/site-packages/_xmlplus/parsers/xmlproc/utils.pys   ? s*   '.
