
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
¿œ^c           @   s‘   d  Z  d d l Z d d l m Z d d l m Z m Z d e j f d „  ƒ  YZ e	 d k r� e ƒ  Z
 e
 j e ƒ  ƒ e
 j e j d ƒ n  d S(	   s—   
A simple demo that reads in an XML document and displays the number of
elements and attributes as well as a tally of elements and attributes by name.
iÿÿÿÿN(   t   defaultdict(   t   make_parsert   handlert   FancyCounterc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s4   d |  _  d |  _ t t ƒ |  _ t t ƒ |  _ d  S(   Ni    (   t   _elemst   _attrsR    t   intt   _elem_typest   _attr_types(   t   self(    (    s+   /usr/lib64/python2.7/Demo/xml/elem_count.pyt   __init__   s    		c         C   se   |  j  d 7_  |  j t | ƒ 7_ |  j | c d 7<x' | j ƒ  D] } |  j | c d 7<qD Wd  S(   Ni   (   R   R   t   lenR   t   keysR   (   R	   t   namet   attrs(    (    s+   /usr/lib64/python2.7/Demo/xml/elem_count.pyt   startElement   s
    c         C   st   d G|  j  Gd GHd G|  j Gd GHd GHx  |  j j ƒ  D] } d | GHq5 Wd GHx  |  j j ƒ  D] } d | GHq] Wd  S(   Ns
   There weres	   elements.s   attributes.s   ---ELEMENT TYPESs   %20s %ds   ---ATTRIBUTE TYPES(   R   R   R   t   itemsR   (   R	   t   pair(    (    s+   /usr/lib64/python2.7/Demo/xml/elem_count.pyt   endDocument   s    (   t   __name__t
   __module__R
   R   R   (    (    (    s+   /usr/lib64/python2.7/Demo/xml/elem_count.pyR      s   		t   __main__i   (   t   __doc__t   syst   collectionsR    t   xml.saxR   R   t   ContentHandlerR   R   t   parsert   setContentHandlert   parset   argv(    (    (    s+   /usr/lib64/python2.7/Demo/xml/elem_count.pyt   <module>   s   	