
1oQc           @   sP  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m	 Z	 m
 Z
 d d l m Z m Z m Z m Z m Z d d l m Z y d d l m Z Wn$ e k
 r d f  d     YZ n Xd	 Z d
 Z d Z d Z d Z e	 j g e j e
 j g Z d   Z d f  d     YZ 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( d! f  d"     YZ) d# f  d$     YZ* d% f  d&     YZ+ d' f  d(     YZ, d) f  d*     YZ- d+ e- f d,     YZ. d- e- f d.     YZ/ d/ e- f d0     YZ0 d1 f  d2     YZ1 d3 f  d4     YZ2 d5 f  d6     YZ3 d7 f  d8     YZ4 d9 f  d:     YZ5 d; f  d<     YZ6 d= f  d>     YZ7 d? f  d@     YZ8 dA e% e8 f dB     YZ9 dC e9 f dD     YZ: dE e9 f dF     YZ; dG e9 f dH     YZ< dI f  dJ     YZ= dK e9 f dL     YZ> dM e9 e( e' f dN     YZ? dO e? e( e7 e' f dP     YZ@ dQ e9 e( e' e* f dR     YZA dS e9 e( e, f dT     YZB dU e9 e) e& f dV     YZC dW e9 e) e, f dX     YZD dY e9 f dZ     YZE d[ eE f d\     YZF d] eE f d^     YZG d_ eE f d`     YZH da e9 e+ e' f db     YZI dc eI e7 f dd     YZJ de e9 e+ e, f df     YZK dg eJ e* f dh     YZL di e9 e0 f dj     YZM dk e9 e. f dl     YZN dm e9 e/ f dn     YZO do e9 e- e& f dp     YZP dq e9 e- e, f dr     YZQ ds e9 e& e6 f dt     YZR du eR e7 f dv     YZS dw e9 e& e3 f dx     YZT dy eT e3 e7 f dz     YZU d{ f  d|     YZV e jW d}  d} d} f k r!eX ZY n d d lZ ZZ eZ jZ ZY d~ eY f d     YZ[ d S(   s   $Id$iN(   t   SCHEMAt   XMLNSt   SOAPt   APACHE(   t   DOMt   DOMExceptiont
   Collectiont
   SplitQNamet   basejoin(   t   StringIO(   t   RLockR
   c           B   s   e  Z d    Z d   Z RS(   c           C   s   d  S(   N(    (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   acquire    s    c           C   s   d  S(   N(    (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   release#   s    (   t   __name__t
   __module__R   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR
      s   	t   typest   attr_groupst	   attr_declt   elementst   model_groupsc         C   s,   |  } x t  | t  s' | j   } q	 W| S(   sB   convience function for finding the parent XMLSchema instance.
    (   t
   isinstancet	   XMLSchemat   _parent(   t	   componentt   parent(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt	   GetSchema1   s    t   SchemaReaderc           B   sz   e  Z d  Z i  Z d d d  Z d   Z d   Z d   Z d   Z	 d   Z
 d d  Z d   Z d d	  Z d
   Z RS(   sE   A SchemaReader creates XMLSchema objects from urls and xml data.
    c         C   s=   | |  _  | |  _ |  j s' t |  _ n  i  |  _ i  |  _ d S(   se   domReader -- class must implement DOMAdapterInterface
           base_url -- base url string
        N(   t   _SchemaReader__base_urlt   _SchemaReader__readerClasst
   DOMAdaptert	   _includest   _imports(   t   selft	   domReadert   base_url(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   __init__@   s    				c         C   sJ   xC | j  j   D]2 \ } } | |  j k r | j |  j |  q q Wd S(   s^   Add dictionary of imports to schema instance.
           schema -- XMLSchema instance
        N(   t   importst   itemsR   t   addImportSchema(   R    t   schemat   nst   val(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   __setImportsK   s    c         C   sM   xF | j  j   D]5 \ } } | |  j k r | j | |  j |  q q Wd S(   s_   Add dictionary of includes to schema instance.
           schema -- XMLSchema instance
        N(   t   includesR%   R   t   addIncludeSchemaR   (   R    R'   t   schemaLocationR)   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   __setIncludesS   s    c         C   s   | |  j  | <d S(   s<   provide reader with schema document for a location.
        N(   R   (   R    t   locationR'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   addSchemaByLocation[   s    c         C   s   | |  j  | j <d S(   sC   provide reader with schema document for a targetNamespace.
        N(   R   t   targetNamespace(   R    R'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   addSchemaByNamespace`   s    c         C   sE   |  j  |  } t |  } | | _ | j |  j  | j |  | S(   sR   element -- DOM node or document
           parent -- WSDLAdapter instance
        (   R   R   t   wsdlt
   setBaseUrlR   t   load(   R    R   t   elementt   readerR'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   loadFromNodee   s    	c         C   si   |  j    } | j |  t   } | d k	 r> | j |  n  | j |  |  j |  |  j |  | S(   s   Return an XMLSchema instance loaded from a file object.
           file -- file object
           url -- base location for resolving imports/includes.
        N(   R   t   loadDocumentR   t   NoneR4   R5   t   _SchemaReader__setIncludest   _SchemaReader__setImports(   R    t   filet   urlR7   R'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   loadFromStreamq   s    	c         C   s   |  j  t |   S(   s^   Return an XMLSchema instance loaded from an XML string.
           data -- XML string
        (   R?   R	   (   R    t   data(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   loadFromString   s    c         C   s~   |  j    } |  j r* t |  j |  } n  | j |  | pC t   } | j |  | j |  |  j |  |  j |  | S(   s   Return an XMLSchema instance loaded from the given url.
           url -- URL to dereference
           schema -- Optional XMLSchema instance.
        (	   R   R   R   t   loadFromURLR   R4   R5   R;   R<   (   R    R>   R'   R7   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRB      s    	c         C   sU   |  j  r t |  j  |  } n  t | d  } z |  j | |  } Wd | j   X| S(   sm   Return an XMLSchema instance loaded from the given file.
           filename -- name of file to open
        t   rbN(   R   R   t   openR?   t   close(   R    t   filenameR=   R'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   loadFromFile   s    	N(   R   R   t   __doc__t   namespaceToSchemaR:   R#   R<   R;   R0   R2   R8   R?   RA   RB   RG   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   :   s   						t   SchemaErrorc           B   s   e  Z RS(    (   R   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRJ      s   t   NoSchemaLocationWarningc           B   s   e  Z RS(    (   R   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRK      s   t   DOMAdapterInterfacec           B   s\   e  Z d	 d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(
   c         C   s   t  d   d S(   s   return true if node has attribute
           attr -- attribute to check for
           ns -- namespace of attribute, by default None
        s   adapter method not implementedN(   t   NotImplementedError(   R    t   attrR(   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   hasattr   s    c         G   s   t  d   d S(   sd   returns an ordered list of child nodes
           *contents -- list of node names to return
        s   adapter method not implementedN(   RM   (   R    t   contents(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getContentList   s    c         C   s   t  d   d S(   s!   set attribute dictionary
        s   adapter method not implementedN(   RM   (   R    t
   attributes(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   setAttributeDictionary   s    c         C   s   t  d   d S(   s,   returns a dict of node's attributes
        s   adapter method not implementedN(   RM   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getAttributeDictionary   s    c         C   s   t  d   d S(   s0   returns namespace referenced by prefix.
        s   adapter method not implementedN(   RM   (   R    t   prefix(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getNamespace   s    c         C   s   t  d   d S(   s    returns tagName of node
        s   adapter method not implementedN(   RM   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt
   getTagName   s    c         C   s   t  d   d S(   s5   returns parent element in DOMAdapter or None
        s   adapter method not implementedN(   RM   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getParentNode   s    c         C   s   t  d   d S(   s>   load a Document from a file object
           file --
        s   adapter method not implementedN(   RM   (   R    R=   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR9      s    c         C   s   t  d   d S(   sI   load a Document from an url
           url -- URL to dereference
        s   adapter method not implementedN(   RM   (   R    R>   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRB      s    N(   R   R   R:   RO   RQ   RS   RT   RV   RW   RX   R9   RB   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRL      s   							R   c           B   sw   e  Z d  Z d d  Z d   Z d d  Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z RS(   s    Adapter for ZSI.Utility.DOM
    c         C   s4   t  | d  r | j |  _ n	 | |  _ d |  _ d S(   sX   Reset all instance variables.
           element -- DOM document, node, or None
        t   documentElementN(   RO   RY   t   _DOMAdapter__nodeR:   t   _DOMAdapter__attributes(   R    t   node(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#      s    	c         C   s   |  j  S(   N(   RZ   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getNode   s    c         C   sB   |  j  s |  j   n  | r5 | |  j  j | i   k S| |  j  k S(   s`   attr -- attribute
           ns -- optional namespace, None means unprefixed attribute.
        (   R[   RS   t   get(   R    RN   R(   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRO      s
    	c         G   sz   g  } |  j  j } xU t j |  j  d   D]> } | j | k r( t | j  d | k r( | j |  q( q( Wt	 |  j
 |  S(   Ni   (   RZ   t   ELEMENT_NODER   t   getElementsR:   t   nodeTypeR   t   tagNamet   appendt   mapt	   __class__(   R    RP   t   nodesR_   t   child(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRQ      s    c         C   s=   i  |  _  x- |  j j j   D] } | j |  j  | j <q Wd  S(   N(   R[   RZ   t   _attrst   valuest	   nodeValuet   nodeName(   R    t   v(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRS     s    	c         C   s   |  j  s |  j   n  |  j  S(   N(   R[   RS   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRT     s    	c         C   s
   |  j  j S(   N(   RZ   Rb   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRW     s    c         C   s/   |  j  j j |  j  j k r+ t |  j  j  Sd  S(   N(   RZ   t
   parentNodeRa   R_   R   R:   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRX     s    c         C   s   d } | d k r* t j | |  j  } nf y t j | |  j  } WnJ t k
 r } | d k r t d | |  j j   f   n  t j	 } n X| S(   sm   prefix -- deference namespace prefix in node's context.
           Ascends parent nodes until found.
        t   xmlnst   xmls    %s namespace not declared for %sN(
   R:   R   t   findDefaultNSRZ   t   findNamespaceURIR   RJ   t   _get_tagNameR   t   XML(   R    RU   t	   namespacet   ex(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRV     s    "c         C   s:   t  j |  |  _ t |  j d  r6 |  j j |  _ n  d  S(   NRY   (   R   R9   RZ   RO   RY   (   R    R=   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR9   *  s    c         C   s:   t  j |  |  _ t |  j d  r6 |  j j |  _ n  d  S(   NRY   (   R   RB   RZ   RO   RY   (   R    R>   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRB   /  s    N(   R   R   RH   R:   R#   R]   RO   RQ   RS   RT   RW   RX   RV   R9   RB   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR      s   
	
								t   XMLBasec           B   s,   e  Z d  Z d Z d Z e   Z d   Z RS(   s7    These class variables are for string indentation.
    i    c         C   s   t  j j   t  j d 7_ d t |  j  d } x; |  j j   D]* \ } } | d t  j d | | f 7} qC Wt  j d 8_ t  j j   | S(   Ni   t   <s   >
s   %s* %s = %s
s     (	   Rv   t   _XMLBase__rlockR   t   _XMLBase__indentt   strRe   t   __dict__R%   R   (   R    t   tmpt   kRl   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   __str__<  s    "N(	   R   R   RH   R:   t   tagRy   R
   Rx   R~   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRv   5  s
   	t   DefinitionMarkerc           B   s   e  Z d  Z RS(   s   marker for definitions
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   M  s   t   DeclarationMarkerc           B   s   e  Z d  Z RS(   s   marker for declarations
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   S  s   t   AttributeMarkerc           B   s   e  Z d  Z RS(   s   marker for attributes
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   Y  s   t   AttributeGroupMarkerc           B   s   e  Z d  Z RS(   s    marker for attribute groups
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   _  s   t   WildCardMarkerc           B   s   e  Z d  Z RS(   s   marker for wildcards
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   e  s   t   ElementMarkerc           B   s   e  Z d  Z RS(   s   marker for wildcards
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   k  s   t   ReferenceMarkerc           B   s   e  Z d  Z RS(   s   marker for references
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   q  s   t   ModelGroupMarkerc           B   s   e  Z d  Z RS(   s   marker for model groups
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   w  s   t	   AllMarkerc           B   s   e  Z d  Z RS(   s   marker for all model group
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   }  s   t   ChoiceMarkerc           B   s   e  Z d  Z RS(   s"   marker for choice model group
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   SequenceMarkerc           B   s   e  Z d  Z RS(   s$   marker for sequence model group
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   ExtensionMarkerc           B   s   e  Z d  Z RS(   s   marker for extensions
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   RestrictionMarkerc           B   s8   e  Z d  Z d d d d d d d d d	 d
 d d g Z RS(   s   marker for restrictions
    t   enumerationt   lengtht   maxExclusivet   maxInclusivet	   maxLengtht   minExclusivet   minInclusivet	   minLengtht   patternt   fractionDigitst   totalDigitst
   whiteSpace(   R   R   RH   t   facets(    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   SimpleMarkerc           B   s   e  Z d  Z RS(   s'   marker for simple type information
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t
   ListMarkerc           B   s   e  Z d  Z RS(   s    marker for simple type list
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   UnionMarkerc           B   s   e  Z d  Z RS(   s!   marker for simple type Union
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   ComplexMarkerc           B   s   e  Z d  Z RS(   s(   marker for complex type information
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   LocalMarkerc           B   s   e  Z d  Z RS(   s(   marker for complex type information
    (   R   R   RH   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   t   MarkerInterfacec           B   s   e  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 d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isDefinition  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isDeclaration  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isAttribute  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isAttributeGroup  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt	   isElement  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isReference  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt
   isWildCard  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isModelGroup  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isAll  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isChoice  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt
   isSequence  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isExtension  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isRestriction  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isSimple  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt	   isComplex  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isLocal  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isList  s    c         C   s   t  |  t  S(   N(   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isUnion  s    (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s$   																	t   XMLSchemaComponentc           B   s   e  Z d  Z g  Z i  Z i  Z d Z d Z d Z d d  Z
 d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s   
       class variables:
           required -- list of required attributes
           attributes -- dict of default attribute values, including None.
               Value can be a function for runtime dependencies.
           contents -- dict of namespace keyed content lists.
               'xsd' content of xsd namespace.
           xmlns_key -- key for declared xmlns namespace.
           xmlns -- xmlns is special prefix for namespace dictionary
           xml -- special xml prefix for xml namespace.
    t    Rn   Ro   c         C   s   d |  _ | |  _ |  j r0 t j |  |  _ n  |  j t k r t |  j j  t t j  k o t |  j j  t t j  k o t |  j j	  t t j	  k r t
 d |  j   n  d S(   s~   parent -- parent instance
           instance variables:
               attributes -- dictionary of node's attributes
        s#   Bad type for a class variable in %sN(   R:   RR   R   t   weakreft   refRe   R   t   typet   requiredRP   t   RuntimeError(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   	  s    			!!"c         C   s  |  g  d d f \ } } } } x t  | t  r t  | t  r | j |  } | s | j |  } | s | j d | j  q | j d | j | f  n | j d | j | f  | j   } q! Wy | j   } Wn d } n X| j d | j | f  | j   d j	 |  S(   s6   Returns a node trace up to the <schema> item.
        t   nameR   s   <%s>s   <%s ref="%s">s   <%s name="%s">R   s   <%s targetNamespace="%s">(
   R   R   t   WSDLToolsAdaptert   getAttributeRc   R   R   t   getTargetNamespacet   reverset   join(   R    t   itemt   pathR   R   RN   t   tns(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getItemTrace  s"    #

c         C   si   |  } d } |  j  j |  } x> | r^ | r^ | j d k	 r^ | j   } | j  j |  } q! W| ph d S(   s   return targetNamespace
        R1   R   N(   RR   R^   R   R:   (   R    R   R1   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   1  s    c         C   s   |  j  t |  S(   s   attribute -- attribute with a QName value (eg. type).
           collection -- check types collection in parent Schema instance
        (   t   getQNameAttributet
   ATTRIBUTES(   R    t	   attribute(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getAttributeDeclaration<  s    c         C   s   |  j  t |  S(   s   attribute -- attribute with a QName value (eg. type).
           collection -- check types collection in parent Schema instance
        (   R   t   ATTRIBUTE_GROUPS(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getAttributeGroupB  s    c         C   s   |  j  t |  S(   s   attribute -- attribute with a QName value (eg. type).
           collection -- check types collection in parent Schema instance
        (   R   t   TYPES(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getTypeDefinitionH  s    c         C   s   |  j  t |  S(   s   attribute -- attribute with a QName value (eg. element).
           collection -- check elements collection in parent Schema instance.
        (   R   t   ELEMENTS(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getElementDeclarationN  s    c         C   s   |  j  t |  S(   s   attribute -- attribute with a QName value (eg. ref).
           collection -- check model_group collection in parent Schema instance.
        (   R   t   MODEL_GROUPS(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getModelGroupT  s    c         C   sH   |  j  |  } | s d S|  j | | j   | j    } | rD | Sd S(   s
  returns object instance representing QName --> (namespace,name),
           or if does not exist return None.
           attribute -- an information item attribute, with a QName value.
           collection -- collection in parent Schema instance to search.
        N(   t   getAttributeQNamet   getSchemaItemR   t   getName(   R    t
   collectionR   t   tdct   obj(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   Z  s    !c         C   s  t  |   } | j | k re y t | |  | } Wn, t k
 r` } t d | | | f   n X| S| | j k r | t k r d St d | j | f   n  | j | } t | t  s | j	   } | d k	 r | | j | <q n  | d k r| t k rd St d |   n  t | t  s8t d |   n  y t | |  | } Wn, t k
 r}} t d | | | f   n X| S(   s8  returns object instance representing namespace, name,
           or if does not exist return None if built-in, else
           raise SchemaError.

           namespace -- namespace item defined in.
           name -- name of item.
           collection -- collection in parent Schema instance to search.
        s2   targetNamespace(%s) collection(%s) has no item(%s)Ns*   schema "%s" does not import namespace "%s"s/   no schema instance for imported namespace (%s).s%   expecting XMLSchema instance not "%r"(   R   R1   t   getattrt   KeyErrorR$   t   BUILT_IN_NAMESPACESRJ   R   R   t	   getSchemaR:   t	   TypeError(   R    R   Rt   R   R   R   Ru   R'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   k  s8    	c         C   s   | t  j k r t j S|  } |  j t  j j | p8 t  j  } xq | s | j   } | j t  j j | po t  j  } | rA t	 | t
  rA | d k r d St d |   qA qA W| S(   sA   deference prefix or by default xmlns, returns namespace.
        R   s   unknown prefix %sN(   R   Ro   R   Rs   RR   Rn   R^   t	   xmlns_keyR   R   R   R:   RJ   (   R    RU   R   R(   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getXMLNS  s    	c         C   s   t  |  t t f k rp t |  d k r9 t d   n  |  j j | d  } | d k r_ d S| j | d  S|  j j |  S(   s1   return requested attribute value or None
        i   s6   To access attributes must use name or (namespace,name)i    i   N(   R   t   listt   tuplet   lent   LookupErrorRR   R^   R:   (   R    R   t   ns_dict(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   si   |  j  |  } t | t  t k r( | S| d k r8 d St |  \ } } |  j |  } t | | f  S(   sE   return requested attribute value as (namespace,name) or None
        N(   R   R   t   TypeDescriptionComponentt   TrueR:   R   R   (   R    R   t   qnameRU   t   ncnameRt   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   s   |  j  d  S(   s&   return attribute name or None
        R   (   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getAttributeName  s    c   	      C   sa  i i  t  j 6|  _ x| j   j   D]\ } } t |  \ } } | t  j k rp | |  j | | pl t  j <q& | r | j |  } | s t d |   n  | |  j k r i  |  j | <n, | |  j | k r t d | | f   n  | |  j | | <q& | |  j k r| |  j | <q& t d |   q& Wt	 |  t
  sL|  j   n  |  j   xr d d d d d d	 g D]X } | |  j k rot |  j j |   \ } } t |  j |  | f  |  j | <qoqoWx d
 g D] } | |  j k r|  j | } g  |  j | <xR | j   D]A } t |  \ } } |  j d
 j t |  j |  | f   qWqqWd S(   s^  Sets up attribute dictionary, checks for required attributes and
           sets default attribute values. attr is for default attribute values
           determined at runtime.

           structure of attributes dictionary
               ['xmlns'][xmlns_key] --  xmlns namespace
               ['xmlns'][prefix] --  declared namespace prefix
               [namespace][prefix] -- attributes declared in a namespace
               [attribute] -- attributes w/o prefix, default namespaces do
                   not directly apply to attributes, ie Name can't collide
                   with QName.
        s$   no namespace for attribute prefix %ss*   attribute %s declared multiple times in %ss$   attribute %s declared multiple timesR   R6   t   baseR   t   substitutionGroupt   itemTypet   memberTypesN(   R   Rn   RR   RT   R%   R   R   RV   RJ   R   R   t$   _XMLSchemaComponent__checkAttributest)   _XMLSchemaComponent__setAttributeDefaultsR^   R   R   t   splitRc   (	   R    R\   R}   Rl   RU   t   valueR(   t   qnamesR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   setAttributes  sB    
)c         C   s   | j  |  j j d   S(   s   retrieve xsd contents
        t   xsd(   RQ   Re   RP   (   R    R\   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getContents  s    c         C   s   x |  j  j j   D]o \ } } | d k	 r | |  j k oE t k n r t | t j  rr | |   |  j | <q | |  j | <q q Wd S(   s   Looks for default values for unset attributes.  If
           class variable representing attribute is None, then
           it must be defined as an instance variable.
        N(   Re   RR   R%   R:   t   FalseR   R   t   FunctionType(   R    R}   Rl   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   __setAttributeDefaults  s
    +c         C   s   x? |  j  j D]1 } | |  j k r t d |  j  | f   q q Wx |  j j   D] \ } } t |  t k rv qR n  | t j t	 j
 f k r qR n  | |  j  j j   k rR |  j   o |  j   rR t d |  j   | |  j | f   qR qR Wd S(   s   Checks that required attributes have been defined,
           attributes w/default cannot be required.   Checks
           all defined attributes are legal, attribute
           references are not subject to this test.
        s0   class instance %s, missing required attribute %ss   %s, unknown attribute(%s, %s)N(   Re   R   RR   RJ   R%   R   t   dictR   Rn   R   Rs   t   keysR   R   R   (   R    t   aRl   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   __checkAttributes  s     N(   R   R   RH   R   RR   RP   R   Rn   Ro   R:   R#   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s2   									3				6		R   c           B   s:   e  Z d  Z i d d 6d d 6Z d Z d   Z d   Z RS(   sE   WSDL Adapter to grab the attributes from the wsdl document node.
    R   R1   t   definitionsc         C   s-   t  j |  d | |  j t | j   d  S(   NR   (   R   R#   R   R   t   document(   R    R3   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   5  s    c         C   s   |  j    j S(   s0   returns WSDLTools.WSDL types Collection
        (   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getImportSchemas9  s    N(   R   R   RH   R:   RR   R   R#   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   /  s
   	t   Notationc           B   sa   e  Z d  Z d d g Z i d
 d 6d
 d 6d
 d 6d
 d 6Z i d d 6Z d Z d   Z d	   Z	 RS(   s   <notation>
       parent:
           schema
       attributes:
           id -- ID
           name -- NCName, Required
           public -- token, Required
           system -- anyURI
       contents:
           annotation?
    R   t   publict   idt   systemt
   annotationR   t   notationc         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   P  s    c         C   s   |  j  |  |  j |  } xr | D]j } t | j    d } | d k rw |  j rw t |   |  _ |  j j |  q# t d | j     q# Wd  S(   Ni   R   s   Unknown component (%s)(   R   R   R   RW   R   t
   Annotationt   fromDomRJ   (   R    R\   RP   t   iR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  T  s    N(
   R   R   RH   R   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   ?  s   "	R  c           B   sl   e  Z d  Z i d d 6Z i d d 6Z d Z d   Z d   Z d e	 f d	     YZ
 d
 e	 f d     YZ RS(   s  <annotation>
       parent:
           all,any,anyAttribute,attribute,attributeGroup,choice,complexContent,
           complexType,element,extension,field,group,import,include,key,keyref,
           list,notation,redefine,restriction,schema,selector,simpleContent,
           simpleType,union,unique
       attributes:
           id -- ID
       contents:
           (documentation | appinfo)*
    R   t   documentationt   appinfoR   R   c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   t   content(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   q  s    c         C   s   |  j  |  |  j |  } g  } x^ | D]V } t | j    d } | d k rW q) q) | d k ri q) q) t d | j     q) Wt |  |  _ d  S(   Ni   R  R  s   Unknown component (%s)(   R   R   R   RW   RJ   R   R  (   R    R\   RP   R  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  u  s    t   Documentationc           B   sG   e  Z d  Z i d	 d 6d	 d 6Z i d
 d 6Z d Z d   Z d   Z RS(   s   <documentation>
           parent:
               annotation
           attributes:
               source, anyURI
               xml:lang, language
           contents:
               mixed, any
        t   sources	   xml: langt   mixedt   anyR   R  c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    c         C   s   |  j  |  |  j |  } g  } x^ | D]V } t | j    d } | d k rW q) q) | d k ri q) q) t d | j     q) Wt |  |  _ d  S(   Ni   R
  R  s   Unknown component (%s)(   R   R   R   RW   RJ   R   R  (   R    R\   RP   R  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    N(   s   mixeds   any(	   R   R   RH   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   		t   Appinfoc           B   sG   e  Z d  Z i d	 d 6d	 d 6Z i d
 d 6Z d Z d   Z d   Z RS(   s   <appinfo>
           parent:
               annotation
           attributes:
               source, anyURI
           contents:
               mixed, any
        R	  t   anyURIR
  R  R   R  c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    c         C   s   |  j  |  |  j |  } g  } x^ | D]V } t | j    d } | d k rW q) q) | d k ri q) q) t d | j     q) Wt |  |  _ d  S(   Ni   R
  R  s   Unknown component (%s)(   R   R   R   RW   RJ   R   R  (   R    R\   RP   R  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    N(   s   mixeds   any(	   R   R   RH   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   	N(   s   documentations   appinfo(   R   R   RH   R:   RR   RP   R   R#   R  R   R  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  a  s   		#t   XMLSchemaFakec           B   s   e  Z d    Z RS(   c         C   s"   t  j | d  |  _ | |  _ d  S(   NR1   (   R   t   getAttrR1   R6   (   R    R6   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    (   R   R   R#   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   R   c           B   s0  e  Z d  Z i d- d 6d- d 6d- d 6d- d 6d d 6d d 6d- d 6d- d	 6Z i d. d 6Z d Z d Z d- 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 d%   Z d&   Z d'   Z d- d(  Z d) e f d*     YZ d+ e f d,     YZ RS(/   s  A schema is a collection of schema components derived from one
       or more schema documents, that is, one or more <schema> element
       information items. It represents the abstract notion of a schema
       rather than a single schema document (or other representation).

       <schema>
       parent:
           ROOT
       attributes:
           id -- ID
           version -- token
           xml:lang -- language
           targetNamespace -- anyURI
           attributeFormDefault -- 'qualified' | 'unqualified', 'unqualified'
           elementFormDefault -- 'qualified' | 'unqualified', 'unqualified'
           blockDefault -- '#all' | list of
               ('substitution | 'extension' | 'restriction')
           finalDefault -- '#all' | list of
               ('extension' | 'restriction' | 'list' | 'union')

       contents:
           ((include | import | redefine | annotation)*,
            (attribute, attributeGroup, complexType, element, group,
             notation, simpleType)*, annotation*)*


        attributes -- schema attributes
        imports -- import statements
        includes -- include statements
        redefines --
        types    -- global simpleType, complexType definitions
        elements -- global element declarations
        attr_decl -- global attribute declarations
        attr_groups -- attribute Groups
        model_groups -- model Groups
        notations -- global notations
    R   t   versions	   xml: langR1   t   unqualifiedt   attributeFormDefaultt   elementFormDefaultt   blockDefaultt   finalDefaultt   includet   importt   redefineR   R   t   attributeGroupt   complexTypeR6   t   groupR  t
   simpleTypeR   R   R'   c         C   s  d |  _ d |  _ t j |  |  d   } d   } d   } t |  d | |  _ t |  d | |  _ t |  d | |  _ t |  d | |  _	 t |  d | |  _
 t |  d | |  _ t |  d | |  _ t |  d | |  _ i  |  _ i  |  _ d |  _ t j d  |  _ d S(   s)  parent --
           instance variables:
           targetNamespace -- schema's declared targetNamespace, or empty string.
           _imported_schemas -- namespace keyed dict of schema dependencies, if
              a schema is provided instance will not resolve import statement.
           _included_schemas -- schemaLocation keyed dict of component schemas,
              if schema is provided instance will not resolve include statement.
           _base_url -- needed for relative URLs support, only works with URLs
               relative to initial document.
           includes -- collection of include statements
           imports -- collection of import statements
           elements -- collection of global element declarations
           types -- collection of global type definitions
           attr_decl -- collection of global attribute declarations
           attr_groups -- collection of global attribute group definitions
           model_groups -- collection of model group definitions
           notations -- collection of notations

        c         S   s   |  j  d S(   NR   (   RR   (   R}   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   <lambda>  s    c         S   s   |  j  d S(   NRt   (   RR   (   R}   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         S   s   |  j  d S(   NR-   (   RR   (   R}   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  !  s    t   keyt   wstoolsN(   R:   t   _XMLSchema__nodeR1   R   R#   R   R+   R$   R   R   R   R   R   t	   notationst   _imported_schemast   _included_schemast	   _base_urlt   loggingt	   getLoggert   logger(   R    R   t   fR(   t   sl(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s$    								c         C   s   |  j  S(   s;   
        Interacting with the underlying DOM tree.
        (   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR]   0  s    c         C   sS   t  | t  s t d   n  | j |  j k rC | |  j | j <n t d   d S(   s}   for resolving import statements in Schema instance
           schema -- schema instance
           _imported_schemas
        s   expecting a Schema instances!   import schema bad targetNamespaceN(   R   R   R   R1   R"  RJ   (   R    R'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR&   6  s
    c         C   sZ   t  | t  s t d   n  | j s: | j |  j k rJ | |  j | <n t d   d S(   s   for resolving include statements in Schema instance
           schemaLocation -- schema location
           schema -- schema instance
           _included_schemas
        s   expecting a Schema instances"   include schema bad targetNamespaceN(   R   R   R   R1   R#  RJ   (   R    R-   R'   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR,   B  s    
c         C   s   | |  _  d S(   sb   set the import schema dictionary, which is used to
           reference depedent schemas.
        N(   R"  (   R    t   schema_dict(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   setImportSchemasP  s    c         C   s   |  j  S(   sb   get the import schema dictionary, which is used to
           reference depedent schemas.
        (   R"  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   V  s    c         C   s   t  |  j j    S(   sl   returns tuple of namespaces the schema instance has declared
           itself to be depedent upon.
        (   R   R+   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getSchemaNamespacesToImport\  s    c         C   s   | |  _  d S(   s   set the include schema dictionary, which is keyed with
           schemaLocation (uri).
           This is a means of providing
           schemas to the current schema for content inclusion.
        N(   R#  (   R    R*  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   setIncludeSchemasb  s    c         C   s   |  j  S(   s`   get the include schema dictionary, which is keyed with
           schemaLocation (uri).
        (   R#  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getIncludeSchemasj  s    c         C   s   |  j  S(   s>   get base url, used for normalizing all relative uri's
        (   R$  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt
   getBaseUrlp  s    c         C   s   | |  _  d S(   s>   set base url, used for normalizing all relative uri's
        N(   R$  (   R    R>   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR4   u  s    c         C   s   |  j  j d  S(   s,   return elementFormDefault attribute
        R  (   RR   R^   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getElementFormDefaultz  s    c         C   s   |  j  j d  d k S(   NR  t	   qualified(   RR   R^   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isElementFormDefaultQualified  s    c         C   s   |  j  j d  S(   s.   return attributeFormDefault attribute
        R  (   RR   R^   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getAttributeFormDefault  s    c         C   s   |  j  j d  S(   s&   return blockDefault attribute
        R  (   RR   R^   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getBlockDefault  s    c         C   s   |  j  j d  S(   s&   return finalDefault attribute
        R  (   RR   R^   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getFinalDefault  s    c            s  |   _  | j   } | r t | j    d } | d k r i  }   j |  | j   j    j |  xU | d j   D]3 \ } } |   j d k r~ |   j d | <q~ q~ Wq   j |  n   j |    j     _	 x  j
 |  D]} t | j    d }	 |	 d k rz  j j    }
 |
 j |  |
 j d } |
 j   } |   j   k ry  j | |  n  |
   j | <| j   j   } | j | j    x3 | j   j   j D] } | j | j d   qWxd d d d d	 d
 d g D]v } xm t | |  j   D]V \ } } | t   |  k rbt j    | _ | t   |  | <qt j d  qWqWq |	 d k rt j    j j    }
 |
 j |  |
 j  d  p  j j! }  j" |  } | d  k rt$   } |  | <y |
 j% |  Wqt& k
 rA}   j' j( d | | f   | =q qt) k
 r}   j' j( |   | =d t* f    f d     Y} | |    j+ | <q qXn	 | |
 _, |   j-   k rt j d |  n    j. |  |
   j+ | <q |	 d k rt j d  q |	 d k r't j d  q |	 d k ret/    }
 |
 j |  |
   j0 |
 j  d  <q |	 d k rt1    }
 |
 j |  |
   j2 |
 j  d  <q |	 d k rt3    }
 |
 j |  |
   j4 |
 j  d  <q |	 d k rt5    }
 |
 j |  |
   j6 |
 j  d  <q |	 d k r]t7    }
 |
 j |  |
   j8 |
 j  d  <q |	 d k rt9    }
 |
 j |  |
   j: |
 j  d  <q |	 d k rt;    }
 |
 j |  |
   j: |
 j  d  <q Pq Wd  S(   Ni   R   Rn   R  R-   R$   R   R   R   R   R!  s   Not keeping schema component.R  Rt   s   IMPORT: %s : %st   _LazyEvalImportc              s    e  Z d  Z    f d   Z RS(   s9   Lazy evaluation of import, replace entry in self.imports.c            s    j  |   } | d  k r]   j   } | } t | t  rK | j   } n  | j  |   } n  t | t  r} |   j |  <| Sd  S(   N(   R^   R:   R   R   R   R   R   R$   (   Rt   R'   R   t   wstypes(   R    t   slocd(    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    (   R   R   RH   R   (    (   R    R8  (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR6    s   s0   Detected multiple imports of the namespace "%s" R  s   redefine is ignoredR   s   annotation is ignoredR   R   R  R6   R  R  R  R  (<   R   RX   R   RW   R   t   updateRR   R%   R   R1   R   Re   t   IncludeR  R   R.  R,   R+   R]   t   removeChildt
   childNodest   appendChildt	   cloneNodeR   R   R   R   t   warningst   warnR   RI   t   ImportR   t   empty_namespaceR^   R:   R   t
   loadSchemaRK   R'  t   debugRJ   Rz   R$   t   _schemaR   R&   t   AttributeDeclarationR   t   AttributeGroupDefinitionR   t   ElementDeclarationR   t   ModelGroupDefinitionR   R   R!  t   ComplexTypeR   t
   SimpleType(   R    R\   R/   t   pnodet   pnameRR   R}   Rl   t	   childNodeR   t   tpR)  R'   t   pnRg   R   t	   import_nsRu   R6  (    (   R    R8  s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR5     s    		"		

	RA  c           B   sc   e  Z d  Z i d d 6d d 6d d 6Z i d g d 6Z d Z d   Z d   Z d	   Z	 d
   Z
 RS(   s   <import>
           parent:
               schema
           attributes:
               id -- ID
               namespace -- anyURI
               schemaLocation -- anyURI
           contents:
               annotation?
        R   Rt   R-   R   R   R  c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   RE  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   1  s    	c         C   s   |  j  |  |  j |  } |  j d |  j   k rD t d   n  xr | D]j } t | j    d } | d k r |  j r t |   |  _ |  j j	 |  qK t d | j     qK Wd  S(   NRt   s$   namespace of schema and import matchi   R   s   Unknown component (%s)(
   R   R   RR   R   RJ   R   RW   R   R  R  (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  6  s    c         C   s  |  j  s |  j d } |  j   j   j |  } | rk |  j   j rk |  j   j   j   j |  } n  | s |  j j d  } | s t d |   n  |  j   j   } t d |  } |  j   j   | _ |  j   j	   | _
 | j |  |  _  q n  |  j  p| S(   s   if schema is not defined, first look for a Schema class instance
               in parent Schema.  Else if not defined resolve schemaLocation
               and create a new Schema class instance, and keep a hard reference.
            Rt   R-   s   namespace(%s) is unknownR"   (   RE  RR   R   R   R^   RJ   R/  R   R   R.  R   RB   (   R    R(   R'   R>   R"   R7   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   E  s    	$c         C   s   |  j    j   } t d |  } |  j    j   | _ |  j    j   | _ | |  _ d |  j k rr t	 d   n  | j
 |  j j d  |  d S(   s   
            R"   R-   s%   no schemaLocation attribute in importN(   R   R/  R   R   R   R.  R   RE  RR   RK   RB   R^   (   R    R'   R"   R7   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRC  [  s    	N(   R   R   RH   R:   RR   RP   R   R#   R  R   RC  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRA     s   


			R:  c           B   s\   e  Z d  Z d g Z i d	 d 6d	 d 6Z i d g d 6Z d Z d   Z d   Z	 d   Z
 RS(
   s   <include schemaLocation>
           parent:
               schema
           attributes:
               id -- ID
               schemaLocation -- anyURI, required
           contents:
               annotation?
        R-   R   R   R   R  c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   RE  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   y  s    	c         C   s   |  j  |  |  j |  } xr | D]j } t | j    d } | d k rw |  j rw t |   |  _ |  j j |  q# t d | j     q# Wd  S(   Ni   R   s   Unknown component (%s)(   R   R   R   RW   R   R  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  ~  s    c         C   s   |  j  s |  j   } | j   j |  j d  |  _  |  j  s |  j d } t d | j    } | j   | _ | j   | _	 t
 |  |  _  | j | |  j   q n  |  j  S(   s   if schema is not defined, first look for a Schema class instance
               in parent Schema.  Else if not defined resolve schemaLocation
               and create a new Schema class instance.
            R-   R"   (   RE  R   R.  R^   RR   R   R/  R   R   R   R   RB   (   R    R'   R>   R7   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    		N(   R   R   RH   R   R:   RR   RP   R   R#   R  R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR:  i  s   		

		N(   s   includes   imports   redefines
   annotations	   attributes   attributeGroups   complexTypes   elements   groups   notations
   simpleTypes
   annotation(   R   R   RH   R:   RR   RP   RB  R   R#   R]   R&   R,   R+  R   R,  R-  R.  R/  R4   R0  R2  R3  R4  R5  R5   R   RA  R:  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     sD   %

  
(															IRF  c           B   sk   e  Z d  Z d g Z i d d 6d d 6d d 6d d 6d d 6Z i d d g d 6Z d	 Z d
   Z d   Z	 RS(   s  <attribute name>
       parent:
           schema
       attributes:
           id -- ID
           name -- NCName, required
           type -- QName
           default -- string
           fixed -- string
       contents:
           annotation?, simpleType?
    R   R   R   t   defaultt   fixedR   R  R   R   c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    	c         C   s   |  j  |  |  j |  } x | D] } t | j    d } | d k rw |  j rw t |   |  _ |  j j |  q# | d k r t |   |  _ |  j j |  q# t	 d | j     q# Wd S(   s"    No list or union support
        i   R   R  s   Unknown component (%s)N(
   R   R   R   RW   R   R  R  t   AnonymousSimpleTypeR  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    N(
   R   R   RH   R   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRF    s   	

	t   LocalAttributeDeclarationc           B   sv   e  Z d  Z d g Z i d d 6d d 6d d 6d   d 6d d 6d d 6d d	 6Z i d
 d g d 6Z d   Z d   Z RS(   s  <attribute name>
       parent:
           complexType, restriction, extension, attributeGroup
       attributes:
           id -- ID
           name -- NCName,  required
           type -- QName
           form -- ('qualified' | 'unqualified'), schema.attributeFormDefault
           use -- ('optional' | 'prohibited' | 'required'), optional
           default -- string
           fixed -- string
       contents:
           annotation?, simpleType?
    R   R   R   c         C   s   t  |   j   S(   N(   R   R3  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    t   formt   optionalt   useRR  RS  R   R  R   c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   RF  R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    	c         C   s   |  j  |  |  j |  } x | D] } t | j    d } | d k rw |  j rw t |   |  _ |  j j |  q# | d k r t |   |  _ |  j j |  q# t	 d | j     q# Wd  S(   Ni   R   R  s   Unknown component (%s)(
   R   R   R   RW   R   R  R  RT  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    N(	   R   R   RH   R   R:   RR   RP   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRU    s   	


	t   AttributeWildCardc           B   sQ   e  Z d  Z i d d 6d d 6d d 6Z i d g d 6Z d Z d	   Z d
   Z RS(   sj  <anyAttribute>
       parents:
           complexType, restriction, extension, attributeGroup
       attributes:
           id -- ID
           namespace -- '##any' | '##other' |
                        (anyURI* | '##targetNamespace' | '##local'), ##any
           processContents -- 'lax' | 'skip' | 'strict', strict
       contents:
           annotation?
    R   s   ##anyRt   t   strictt   processContentsR   R   t   anyAttributec         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    c         C   s   |  j  |  |  j |  } xr | D]j } t | j    d } | d k rw |  j rw t |   |  _ |  j j |  q# t d | j     q# Wd  S(   Ni   R   s   Unknown component (%s)(   R   R   R   RW   R   R  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    N(	   R   R   RH   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRY     s   

	t   AttributeReferencec           B   st   e  Z d  Z d g Z i d d 6d d 6d d 6d d 6d d 6Z i d g d 6Z d	 Z d
   Z d d  Z	 d   Z
 RS(   sQ  <attribute ref>
       parents:
           complexType, restriction, extension, attributeGroup
       attributes:
           id -- ID
           ref -- QName, required
           use -- ('optional' | 'prohibited' | 'required'), optional
           default -- string
           fixed -- string
       contents:
           annotation?
    R   R   RW  RX  RR  RS  R   R   R   c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   >  s    c         C   s   t  j |  |  S(   N(   R   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   B  s    c         C   s   |  j  |  |  j |  } xr | D]j } t | j    d } | d k rw |  j rw t |   |  _ |  j j |  q# t d | j     q# Wd  S(   Ni   R   s   Unknown component (%s)(   R   R   R   RW   R   R  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  E  s    N(   R   R   RH   R   R:   RR   RP   R   R#   R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR]  &  s   	

	RG  c           B   se   e  Z d  Z d g Z i d d 6d d 6Z i d d d d g d 6Z d Z d   Z d	   Z	 d
   Z
 RS(   s   <attributeGroup name>
       parents:
           schema, redefine
       attributes:
           id -- ID
           name -- NCName,  required
       contents:
           annotation?, (attribute | attributeGroup)*, anyAttribute?
    R   R   R   R   R  R\  R   c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   t   attr_content(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   d  s    	c         C   s   |  j  S(   N(   R^  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getAttributeContenti  s    c         C   s  |  j  |  |  j |  } g  } xt t |   D]} t | | j    d } | d k r | r t |   |  _ |  j j | |  q5 | d k r| | j	 d  r | j
 t |    n5 | | j	 d  r | j
 t |    n t d   | d j | |  q5 | d k rG| j
 t |    | d j | |  q5 | d	 k rt |  | d k rt d
 |  j     n  | j
 t |    | d j | |  q5 t d | | j     q5 Wt |  |  _ d  S(   Ni   R   R   R   R   s   Unknown attribute typeiR  R\  s"   anyAttribute is out of order in %ss   Unknown component (%s)(   R   R   t   rangeR   R   RW   R  R   R  RO   Rc   RU  R]  RJ   t   AttributeGroupReferenceR   RY  R   R^  (   R    R\   RP   R  t   indxR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  l  s2    N(   R   R   RH   R   R:   RR   RP   R   R#   R_  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRG  R  s   	

		Ra  c           B   s_   e  Z d  Z d g Z i d	 d 6d	 d 6Z i d g d 6Z d Z d   Z d d  Z	 d   Z
 RS(
   s   <attributeGroup ref>
       parents:
           complexType, restriction, extension, attributeGroup
       attributes:
           id -- ID
           ref -- QName, required
       contents:
           annotation?
    R   R   R   R   R  c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    c         C   s   t  j |  |  S(   s   attribute -- attribute with a QName value (eg. type).
           collection -- check types collection in parent Schema instance
        (   R   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   s   |  j  |  |  j |  } xr | D]j } t | j    d } | d k rw |  j rw t |   |  _ |  j j |  q# t d | j     q# Wd  S(   Ni   R   s   Unknown component (%s)(   R   R   R   RW   R   R  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    N(   R   R   RH   R   R:   RR   RP   R   R#   R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRa    s   	

	t   IdentityConstrantsc           B   sb   e  Z d  Z d   Z d   Z d e f d     YZ d e f d     YZ d e f d     YZ RS(	   s   Allow one to uniquely identify nodes in a document and ensure the
       integrity of references between them.

       attributes -- dictionary of attributes
       selector -- XPath to selected nodes
       fields -- list of XPath to key field
    c         C   s/   t  j |  |  d  |  _ d  |  _ d  |  _ d  S(   N(   R   R#   R:   t   selectort   fieldsR   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    		c         C   sF  |  j  |  |  j |  } g  } x| D]} t | j    d } | |  j j d k r| d k r |  j r t |   |  _ |  j j |  q/| d k r |  j	 |   |  _
 |  j
 j |  q) q/| d k r | j |  j |    | d j |  q) q/t d | j     n t d | j     t |  |  _ q) Wd  S(   Ni   R   R   Rd  t   fieldis   Unknown component (%s)(   R   R   R   RW   Re   RP   R   R  R  t   SelectorRd  Rc   t   FieldRJ   R   Re  (   R    R\   RP   Re  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s(    t
   Constraintc           B   s   e  Z d    Z d   Z RS(   c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    c         C   s   |  j  |  |  j |  } x | D] } t | j    d } | |  j j d k r | d k r |  j r t |   |  _ |  j j |  q t	 d | j     q# t	 d | j     q# Wd  S(   Ni   R   R   s   Unknown component (%s)(
   R   R   R   RW   Re   RP   R   R  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    (   R   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRi    s   	Rg  c           B   sA   e  Z d  Z d g Z i d d 6d d 6Z i d g d 6Z d Z RS(   s   <selector xpath>
           parent:
               unique, key, keyref
           attributes:
               id -- ID
               xpath -- XPath subset,  required
           contents:
               annotation?
        t   xpathR   R   R   Rd  N(   R   R   RH   R   R:   RR   RP   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRg    s   		

Rh  c           B   sA   e  Z d  Z d g Z i d d 6d d 6Z i d g d 6Z d Z RS(   s   <field xpath>
           parent:
               unique, key, keyref
           attributes:
               id -- ID
               xpath -- XPath subset,  required
           contents:
               annotation?
        Rj  R   R   R   Rf  N(   R   R   RH   R   R:   RR   RP   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRh    s   		

(	   R   R   RH   R#   R  R   Ri  Rg  Rh  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRc    s   		t   Uniquec           B   sG   e  Z d  Z d g Z i d d 6d d 6Z i d d d g d 6Z d Z RS(	   s   <unique name> Enforce fields are unique w/i a specified scope.

       parent:
           element
       attributes:
           id -- ID
           name -- NCName,  required
       contents:
           annotation?, selector, field+
    R   R   R   Rd  Rf  R   t   uniqueN(   R   R   RH   R   R:   RR   RP   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRk    s   
	

t   Keyc           B   sG   e  Z d  Z d g Z i d d 6d d 6Z i d d d g d 6Z d Z RS(	   sJ  <key name> Enforce fields are unique w/i a specified scope, and all
           field values are present w/i document.  Fields cannot
           be nillable.

       parent:
           element
       attributes:
           id -- ID
           name -- NCName,  required
       contents:
           annotation?, selector, field+
    R   R   R   Rd  Rf  R   R  N(   R   R   RH   R   R:   RR   RP   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRm  &  s   	

t   KeyRefc           B   sQ   e  Z d  Z d d g Z i d	 d 6d	 d 6d	 d 6Z i d d d g d 6Z d Z RS(
   s*  <keyref name refer> Ensure a match between two sets of values in an
           instance.
       parent:
           element
       attributes:
           id -- ID
           name -- NCName,  required
           refer -- QName,  required
       contents:
           annotation?, selector, field+
    R   t   referR   R   Rd  Rf  R   t   keyrefN(   R   R   RH   R   R:   RR   RP   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRn  :  s   

RH  c           B   s   e  Z d  Z d g Z i
 d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d	 6d
   d 6d   d 6Z i d d d d d d g d 6Z d Z d   Z d   Z	 d   Z
 d   Z d d  Z d   Z d   Z e e e d d  Z d   Z RS(    sw  <element name>
       parents:
           schema
       attributes:
           id -- ID
           name -- NCName,  required
           type -- QName
           default -- string
           fixed -- string
           nillable -- boolean,  false
           abstract -- boolean,  false
           substitutionGroup -- QName
           block -- ('#all' | ('substition' | 'extension' | 'restriction')*),
               schema.blockDefault
           final -- ('#all' | ('extension' | 'restriction')*),
               schema.finalDefault
       contents:
           annotation?, (simpleType,complexType)?, (key | keyref | unique)*

    R   R   R   RR  RS  i    t   nillablet   abstractR   c         C   s   |  j    j   S(   N(   R   R4  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  n  s    t   blockc         C   s   |  j    j   S(   N(   R   R5  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  o  s    t   finalR   R  R  R  Rp  Rl  R   R6   c         C   s/   t  j |  |  d  |  _ d  |  _ d |  _ d  S(   N(    (   R   R#   R:   R   R  t   constraints(   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   t  s    		c         C   s   t  S(   s.   Global elements are always qualified.
        (   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isQualifiedz  s    c         C   s   t  j |  |  } | d k s* | d k	 r. | S|  j d k	 rA d S|  } x | j t  j } x< | j   D]. \ } } | t j k r qg n  t	 | d f  SWt
 | t  s t | d  r Pn  | j   } qJ t d   d S(   s   return attribute.
        If attribute is type and it's None, and no simple or complex content,
        return the default type "xsd:anyType"
        R   t   anyTypeR   s"   failed to locate the XSD namespaceN(   R   R   R:   R  RR   Rn   R%   R    t   XSD_LISTR   R   R   RO   R   RJ   (   R    R   R   R   t   nsdictR}   Rl   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s"    c         C   s   t  d |  j   d  S(   Ns   invalid operation for <%s>(   t   WarningR   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   s9   | r t  j |  |  St  j |  d  } | r2 | S|  j S(   s  If attribute is None, "type" is assumed, return the corresponding
        representation of the global type definition (TypeDefinition),
        or the local definition if don't find "type".  To maintain backwards
        compat, if attribute is provided call base class method.
        R   (   R   R   R  (   R    R   t   gt(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   s   |  j  S(   N(   t   _constraints(   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getConstraints  s    c         C   s   t  |  |  _ d  S(   N(   R   R|  (   R    Ru  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   setConstraints  s    s(   tuple of key, keyref, unique constraintsc         C   s  |  j  |  |  j |  } g  } x| D]} t | j    d } | |  j j d k r| d k r |  j r t |   |  _ |  j j |  q| d k r |  j	 r t
 |   |  _	 |  j	 j |  q| d k r|  j	 rt |   |  _	 |  j	 j |  q| d k r6| j t |    | d j |  q| d k ri| j t |    | d j |  q| d	 k r| j t |    | d j |  qt d
 | j     q) t d
 | j     q) W| |  _ d  S(   Ni   R   R   R  R  R  iRp  Rl  s   Unknown component (%s)(   R   R   R   RW   Re   RP   R   R  R  R  RT  t   LocalComplexTypeRc   Rm  Rn  Rk  RJ   Ru  (   R    R\   RP   Ru  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s6    N(   R   R   RH   R   R:   RR   RP   R   R#   Rv  R   R   R   R}  R~  t   propertyRu  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRH  N  s0   	

						t   LocalElementDeclarationc           B   s   e  Z d  Z d g Z i d d 6d d 6d   d 6d d 6d d 6d d 6d d	 6d d
 6d d 6d d 6d   d 6Z i d d d d d d g d 6Z d   Z RS(   s_  <element>
       parents:
           all, choice, sequence
       attributes:
           id -- ID
           name -- NCName,  required
           form -- ('qualified' | 'unqualified'), schema.elementFormDefault
           type -- QName
           minOccurs -- Whole Number, 1
           maxOccurs -- (Whole Number | 'unbounded'), 1
           default -- string
           fixed -- string
           nillable -- boolean,  false
           block -- ('#all' | ('extension' | 'restriction')*), schema.blockDefault
       contents:
           annotation?, (simpleType,complexType)?, (key | keyref | unique)*
    R   R   c         C   s   t  |   j   S(   N(   R   R0  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    RV  R   t   1t	   minOccurst	   maxOccursRR  RS  i    Rq  Rr  c         C   s   t  |   j   S(   N(   R   R4  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    Rs  R   R  R  R  Rp  Rl  R   c         C   sO   |  j  d  } | d k r t S| d k r/ t St d | |  j   f   d S(   s   
Local elements can be qualified or unqualifed according
        to the attribute form, or the elementFormDefault.  By default
        local elements are unqualified.
        RV  R1  R  s   Bad form (%s) for element: %sN(   R   R   R   RJ   R   (   R    RV  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRv    s    N(   R   R   RH   R   R:   RR   RP   Rv  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    	

t   ElementReferencec           B   sm   e  Z d  Z d g Z i d d 6d d 6d d 6d d 6Z i d g d 6Z d Z d	   Z d d
  Z	 d   Z
 RS(   s  <element ref>
       parents:
           all, choice, sequence
       attributes:
           id -- ID
           ref -- QName, required
           minOccurs -- Whole Number, 1
           maxOccurs -- (Whole Number | 'unbounded'), 1
       contents:
           annotation?
    R   R   R  R  R  R   R   R6   c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    c         C   s&   | r t  j |  |  St  j |  d  S(   s   If attribute is None, "ref" is assumed, return the corresponding
        representation of the global element declaration (ElementDeclaration),
        To maintain backwards compat, if attribute is provided call base class method.
        R   (   R   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   s   d  |  _ |  j |  x |  j |  D] } t | j    d } | |  j j d k r& | d k r |  j r t |   |  _ |  j j	 |  q t
 d | j     q& q& Wd  S(   Ni   R   R   s   Unknown component (%s)(   R:   R   R   R   R   RW   Re   RP   R  R  RJ   (   R    R\   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  &  s    	N(   R   R   RH   R   R:   RR   RP   R   R#   R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   	

		t   ElementWildCardc           B   s   e  Z d  Z g  Z i d d 6d d 6d d 6d d 6d d 6Z i d	 g d
 6Z d Z d   Z d   Z	 d   Z
 d   Z d   Z RS(   s  <any>
       parents:
           choice, sequence
       attributes:
           id -- ID
           minOccurs -- Whole Number, 1
           maxOccurs -- (Whole Number | 'unbounded'), 1
           namespace -- '##any' | '##other' |
                        (anyURI* | '##targetNamespace' | '##local'), ##any
           processContents -- 'lax' | 'skip' | 'strict', strict
       contents:
           annotation?
    R   R  R  R  s   ##anyRt   RZ  R[  R   R   R  c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   J  s    c         C   s   t  |   j   S(   s   
        Global elements are always qualified, but if processContents
        are not strict could have dynamically generated local elements.
        (   R   R2  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRv  N  s    c         C   s   t  j |  |  S(   s   return attribute.
        (   R   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   U  s    c         C   s   t  d |  j   d  S(   Ns   invalid operation for <%s>(   Rz  R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   Z  s    c         C   s   d  |  _ |  j |  x |  j |  D] } t | j    d } | |  j j d k r& | d k r |  j r t |   |  _ |  j j	 |  q t
 d | j     q& q& Wd  S(   Ni   R   R   s   Unknown component (%s)(   R:   R   R   R   R   RW   Re   RP   R  R  RJ   (   R    R\   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  ]  s    	N(   R   R   RH   R   R:   RR   RP   R   R#   Rv  R   R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  3  s   

				t   Sequencec           B   s`   e  Z d  Z i d d 6d d 6d d 6Z i d d d d d	 d
 g d 6Z d	 Z d   Z d   Z RS(   sE  <sequence>
       parents:
           complexType, extension, restriction, group, choice, sequence
       attributes:
           id -- ID
           minOccurs -- Whole Number, 1
           maxOccurs -- (Whole Number | 'unbounded'), 1

       contents:
           annotation?, (element | group | choice | sequence | any)*
    R   R  R  R  R   R6   R  t   choicet   sequenceR  R   c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    	c         C   s  |  j  |  |  j |  } g  } x| D]|} t | j    d } | |  j j d k r| d k r |  j r t |   |  _ |  j j |  q) n | d k r | j	 d  r | j
 t |    q{| j
 t |    n | d k r | j
 t |    n| | d k r!| j
 t |    nZ | d k rC| j
 t |    n8 | d	 k re| j
 t |    n t d
 | j     | d j |  q) t d
 | j     q) Wt |  |  _ d  S(   Ni   R   R   R6   R   R  R  R  R  s   Unknown component (%s)i(   R   R   R   RW   Re   RP   R   R  R  RO   Rc   R  R  t   ModelGroupReferencet   ChoiceR  R  RJ   R   R  (   R    R\   RP   R  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s4    N(	   R   R   RH   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  m  s   

	t   Allc           B   sT   e  Z d  Z i d d 6d d 6d d 6Z i d d g d 6Z d Z d	   Z d
   Z RS(   s   <all>
       parents:
           complexType, extension, restriction, group
       attributes:
           id -- ID
           minOccurs -- '0' | '1', 1
           maxOccurs -- '1', 1

       contents:
           annotation?, element*
    R   R  R  R  R   R6   R   t   allc         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    	c         C   s4  |  j  |  |  j |  } g  } x | D] } t | j    d } | |  j j d k r| d k r |  j r t |   |  _ |  j j |  q) n] | d k r | j	 d  r | j
 t |    q | j
 t |    n t d | j     | d j |  q) t d | j     q) Wt |  |  _ d  S(   Ni   R   R   R6   R   s   Unknown component (%s)i(   R   R   R   RW   Re   RP   R   R  R  RO   Rc   R  R  RJ   R   R  (   R    R\   RP   R  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s$    N(	   R   R   RH   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   

	R  c           B   s`   e  Z d  Z i d d 6d d 6d d 6Z i d d d d d	 d
 g d 6Z d Z d   Z d   Z RS(   sC  <choice>
       parents:
           complexType, extension, restriction, group, choice, sequence
       attributes:
           id -- ID
           minOccurs -- Whole Number, 1
           maxOccurs -- (Whole Number | 'unbounded'), 1

       contents:
           annotation?, (element | group | choice | sequence | any)*
    R   R  R  R  R   R6   R  R  R  R  R   c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    	c         C   s  |  j  |  |  j |  } g  } x| D]|} t | j    d } | |  j j d k r| d k r |  j r t |   |  _ |  j j |  q) n | d k r | j	 d  r | j
 t |    q{| j
 t |    n | d k r | j
 t |    n| | d k r!| j
 t |    nZ | d k rC| j
 t |    n8 | d	 k re| j
 t |    n t d
 | j     | d j |  q) t d
 | j     q) Wt |  |  _ d  S(   Ni   R   R   R6   R   R  R  R  R  s   Unknown component (%s)i(   R   R   R   RW   Re   RP   R   R  R  RO   Rc   R  R  R  R  R  R  RJ   R   R  (   R    R\   RP   R  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s4    N(	   R   R   RH   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   

	RI  c           B   s\   e  Z d  Z d g Z i d d 6d d 6Z i d d d d g d 6Z d Z d	   Z d
   Z	 RS(   s   <group name>
       parents:
           redefine, schema
       attributes:
           id -- ID
           name -- NCName,  required

       contents:
           annotation?, (all | choice | sequence)?
    R   R   R   R  R  R  R   R  c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   %	  s    	c         C   sO  |  j  |  |  j |  } x,| D]$} t | j    d } | |  j j d k r1| d k r |  j r t |   |  _ |  j j |  q# n | d k r |  j	 r t
 |   |  _	 nf | d k r |  j	 r t |   |  _	 n> | d k r|  j	 rt |   |  _	 n t d | j     |  j	 j |  q# t d | j     q# Wd  S(   Ni   R   R   R  R  R  s   Unknown component (%s)(   R   R   R   RW   Re   RP   R   R  R  R  R  R  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  *	  s$    N(
   R   R   RH   R   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRI  	  s   	

	R  c           B   sj   e  Z d  Z d g Z i d d 6d d 6d d 6d d 6Z i d g d 6Z d Z d	   Z d
   Z	 d   Z
 RS(   s5  <group ref>
       parents:
           choice, complexType, extension, restriction, sequence
       attributes:
           id -- ID
           ref -- NCName,  required
           minOccurs -- Whole Number, 1
           maxOccurs -- (Whole Number | 'unbounded'), 1

       contents:
           annotation?
    R   R   R  R  R  R   R   R  c         C   s   t  j |  |  d  |  _ d  S(   N(   R   R#   R:   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   Y	  s    c         C   s   |  j  d  S(   NR   (   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getModelGroupReference]	  s    c         C   s   |  j  |  |  j |  } x | D] } t | j    d } | |  j j d k r | d k r |  j r t |   |  _ |  j j |  q t	 d | j     q# t	 d | j     q# Wd  S(   Ni   R   R   s   Unknown component (%s)(
   R   R   R   RW   Re   RP   R   R  R  RJ   (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  `	  s    N(   R   R   RH   R   R:   RR   RP   R   R#   R  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  B	  s   	

		RJ  c           B   s   e  Z d  Z d g Z i d# d 6d# d 6d d 6d d 6d   d 6d   d	 6Z i d
 d d d d d d d d d d g d 6Z d Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d e f d     YZ d e e f d      YZ d! e e f d"     YZ RS($   s*  <complexType name>
       parents:
           redefine, schema
       attributes:
           id -- ID
           name -- NCName,  required
           mixed -- boolean, false
           abstract -- boolean,  false
           block -- ('#all' | ('extension' | 'restriction')*), schema.blockDefault
           final -- ('#all' | ('extension' | 'restriction')*), schema.finalDefault

       contents:
           annotation?, (simpleContent | complexContent |
           ((group | all | choice | sequence)?, (attribute | attributeGroup)*, anyAttribute?))
    R   R   i    R
  Rr  c         C   s   |  j    j   S(   N(   R   R4  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  	  s    Rs  c         C   s   |  j    j   S(   N(   R   R5  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  	  s    Rt  R   t   simpleContentt   complexContentR  R  R  R  R   R  R\  R  R   R  c         C   s/   t  j |  |  d  |  _ d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  R^  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   	  s    		c         C   sk   |  j  d  } | s t St | t  rK | d k r8 t S| d k rK t Sn  t d | |  j   f   d  S(	   NR
  t   falset   0t   trueR  s)   invalid value for attribute mixed(%s): %s(   R  R  (   R  R  (   R   R   R   t
   basestringR   RJ   R   (   R    t   m(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   isMixed	  s    c         C   s   |  j  S(   N(   R^  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR_  	  s    c         C   s   t  d |  j   d  S(   Ns   invalid operation for <%s>(   Rz  R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   	  s    c         C   s   t  d |  j   d  S(   Ns   invalid operation for <%s>(   Rz  R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   	  s    c         C   s  |  j  |  |  j |  } d } t |  } | s8 d  St | | j    d } | d k r t |   |  _ |  j j | |  | d 7} | | k  r t | | j    d } q n  d  |  _	 | d k r |  j
 j |   |  _	 |  j	 j | |  n| d k r0|  j
 j |   |  _	 |  j	 j | |  n| d k rNt |   |  _	 nZ | d k rlt |   |  _	 n< | d k rt |   |  _	 n | d	 k rt |   |  _	 n  |  j	 r|  j	 j | |  | d 7} n  g  |  _ x| | k  rt | | j    d } | d
 k rU| | j d  r<|  j j t |    q|  j j t |    np | d k rz|  j j t |    nK | d k r|  j j t |    n& t d | | j   |  j   f   |  j d j | |  | d 7} qWd  S(   Ni    i   R   R  R  R  R  R  R  R   R   R  R\  s   Unknown component (%s): %si(   R   R   R   R   RW   R  R   R  R:   R  Re   t   SimpleContentt   ComplexContentR  R  R  R  R^  RO   Rc   R]  RU  Ra  RY  RJ   R   (   R    R\   RP   Rb  t   numR   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  	  sZ    
 			&t   _DerivedTypec           B   s   e  Z d    Z d   Z RS(   c         C   s/   t  j |  |  d  |  _ d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   t
   derivationR  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   	  s    		c         C   s?  |  j  |  |  j |  } x| D]} t | j    d } | |  j j d k r| d k r |  j r t |   |  _ |  j j |  q# q| d k r |  j	 r |  j j
 |   |  _	 q| d k r |  j	 r |  j j |   |  _	 qt d | j     n t d | j     |  j	 j |  q# W|  j	 |  _ d  S(   Ni   R   R   t   restrictiont	   extensions   Unknown component (%s)(   R   R   R   RW   Re   RP   R   R  R  R  t   Restrictiont	   ExtensionRJ   R  (   R    R\   RP   R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  	  s"    (   R   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  	  s   	R  c           B   s   e  Z d  Z i d d 6d d 6Z i d d d g d 6Z d Z d	   Z d
 e f d     YZ	 d e	 e
 f d     YZ d e	 e f d     YZ RS(   s   <complexContent>
           parents:
               complexType
           attributes:
               id -- ID
               mixed -- boolean, false

           contents:
               annotation?, (restriction | extension)
        R   i    R
  R   R  R  R   R  c         C   sq   |  j  d  } | s t St | t  t k rQ | d k r> t S| d k rQ t Sn  t d | |  j   f   d  S(	   NR
  R  R  R  R  s)   invalid value for attribute mixed(%s): %s(   s   falseR  (   s   trueR  (   R   R   R   R  R   RJ   R   (   R    R  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s    t   _DerivationBasec        	   B   sk   e  Z d  Z d g Z i d d 6d d 6Z i d d d d d d d	 d
 g d 6Z d   Z d   Z d   Z	 RS(   sd  <extension>,<restriction>
               parents:
                   complexContent
               attributes:
                   id -- ID
                   base -- QName, required

               contents:
                   annotation?, (group | all | choice | sequence)?,
                       (attribute | attributeGroup)*, anyAttribute?
            R   R   R   R  R  R  R  R   R  R\  R   c         C   s/   t  j |  |  d  |  _ d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  R^  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   ,
  s    		c         C   s   |  j  S(   N(   R^  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR_  2
  s    c         C   s  |  j  |  |  j |  } d } t |  } | s8 d  St | | j    d } | d k r t |   |  _ |  j j | |  | d 7} t | | j    d } n  | d k r t |   |  _	 |  j	 j | |  | d 7} n | d k r t
 |   |  _	 |  j	 j | |  | d 7} n | d k r\t |   |  _	 |  j	 j | |  | d 7} nE | d k rt |   |  _	 |  j	 j | |  | d 7} n	 d  |  _	 g  |  _ x-| | k  rt | | j    d } | d k r$| | j d	  r|  j j t |    q|  j j t |    n | d
 k ru| | j d	  r\|  j j t |    q|  j j t |    n? | d k r|  j j t |    n t d | | j     |  j d j | |  | d 7} qWd  S(   Ni    i   R   R  R  R  R  R   R   R  R\  s   Unknown component (%s)i(   R   R   R   R   RW   R  R   R  R  R  R  R  R  R:   R^  RO   Rc   R]  RU  Ra  RG  RY  RJ   (   R    R\   RP   Rb  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  5
  sZ    
		N(
   R   R   RH   R   R:   RR   RP   R#   R_  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s   	

		R  c           B   s   e  Z d  Z d Z RS(   s[  <extension base>
               parents:
                   complexContent
               attributes:
                   id -- ID
                   base -- QName, required

               contents:
                   annotation?, (group | all | choice | sequence)?,
                       (attribute | attributeGroup)*, anyAttribute?
            R  (   R   R   RH   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  l
  s   R  c           B   s   e  Z d  Z d Z RS(   s]  <restriction base>
               parents:
                   complexContent
               attributes:
                   id -- ID
                   base -- QName, required

               contents:
                   annotation?, (group | all | choice | sequence)?,
                       (attribute | attributeGroup)*, anyAttribute?
            R  (   R   R   RH   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  {
  s   N(   R   R   RH   R:   RR   RP   R   R  R   R  R   R  R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  	  s   

	RR  c           B   si   e  Z d  Z i d d 6Z i d d d g d 6Z d Z d e e f d     YZ	 d	 e e
 f d
     YZ RS(   s   <simpleContent>
           parents:
               complexType
           attributes:
               id -- ID

           contents:
               annotation?, (restriction | extension)
        R   R   R  R  R   R  R  c           B   se   e  Z d  Z d g Z i d d 6d d 6Z i d d d d g d 6Z d Z d	   Z d
   Z	 d   Z
 RS(   s  <extension base>
               parents:
                   simpleContent
               attributes:
                   id -- ID
                   base -- QName, required

               contents:
                   annotation?, (attribute | attributeGroup)*, anyAttribute?
            R   R   R   R   R  R\  R   R  c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R^  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   
  s    	c         C   s   |  j  S(   N(   R^  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR_  
  s    c         C   s  |  j  |  |  j |  } d } t |  } | r t | | j    d } | d k r t |   |  _ |  j j | |  | d 7} t | | j    d } q n  g  } x | | k  rt | | j    d } | d k r!| | j d  r| j	 t
 |    q| j	 t |    n^ | d k rC| j	 t |    n< | d k re| j	 t |    n t d | | j     | d	 j | |  | d 7} q Wt |  |  _ d  S(
   Ni    i   R   R   R   R  R\  s   Unknown component (%s)i(   R   R   R   R   RW   R  R   R  RO   Rc   R]  RU  Ra  RY  RJ   R   R^  (   R    R\   RP   Rb  R  R   R  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s4    
 N(   R   R   RH   R   R:   RR   RP   R   R#   R_  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s   	

		R  c           B   so   e  Z d  Z d g Z i d d 6d d 6Z i d d d d d g e j d 6Z d	 Z	 d
   Z
 d   Z d   Z RS(   s  <restriction base>
               parents:
                   simpleContent
               attributes:
                   id -- ID
                   base -- QName, required

               contents:
                   annotation?, simpleType?, (enumeration | length |
                   maxExclusive | maxInclusive | maxLength | minExclusive |
                   minInclusive | minLength | pattern | fractionDigits |
                   totalDigits | whiteSpace)*, (attribute | attributeGroup)*,
                   anyAttribute?
            R   R   R   R  R   R  R\  R   R  c         C   s/   t  j |  |  d  |  _ d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  R^  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   
  s    		c         C   s   |  j  S(   N(   R^  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR_  
  s    c         C   s  g  |  _  |  j |  |  j |  } d } t |  } t | | j    d } | d k r t |   |  _ |  j j | |  | d 7} t | | j    d } n  g  } x/| | k  rt | | j    d } | d k r!| | j	 d  r| j
 t |    q| j
 t |    n | d k rC| j
 t |    ny | d k re| j
 t |    nW | d k r|  j  j
 t |    |  j  d	 j | |  n t d
 | | j     | d	 j | |  | d 7} q Wt |  |  _ d  S(   Ni    i   R   R   R   R  R\  R  is   Unknown component (%s)(   R  R   R   R   R   RW   R  R   R  RO   Rc   R]  RU  Ra  RY  RT  RJ   R   R^  (   R    R\   RP   Rb  R  R   R  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s:    	
N(   R   R   RH   R   R:   RR   R   R   RP   R   R#   R_  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s   	

		N(   R   R   RH   R:   RR   RP   R   R   R   R  R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s   
;N(   R   R   RH   R   R:   RR   RP   R   R#   R  R_  R   R   R  R   R  R   R  R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRJ  p	  s.   	

						7R  c           B   s.   e  Z d  Z g  Z i d d 6d d 6Z d Z RS(   s*  <complexType>
       parents:
           element
       attributes:
           id -- ID
           mixed -- boolean, false

       contents:
           annotation?, (simpleContent | complexContent |
           ((group | all | choice | sequence)?, (attribute | attributeGroup)*, anyAttribute?))
    R   i    R
  R  N(   R   R   RH   R   R:   RR   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s
   

RK  c           B   s   e  Z d  Z d g Z i d d 6d d 6d   d 6Z i d d d d g d	 6Z d
 Z d   Z d   Z	 d   Z
 d   Z d e e f d     YZ d e e f d     YZ d e e f d     YZ RS(   sI  <simpleType name>
       parents:
           redefine, schema
       attributes:
           id -- ID
           name -- NCName, required
           final -- ('#all' | ('extension' | 'restriction' | 'list' | 'union')*),
               schema.finalDefault

       contents:
           annotation?, (restriction | list | union)
    R   R   c         C   s   |  j    j   S(   N(   R   R5  (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  >  s    Rt  R   R  R   t   unionR   R  c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   B  s    	c         C   s   t  d |  j   d  S(   Ns   invalid operation for <%s>(   Rz  R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   G  s    c         C   s   t  d |  j   d  S(   Ns   invalid operation for <%s>(   Rz  R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   J  s    c         C   s	  |  j  |  |  j |  } xZ | D]N } t | j    d } | d k rp t |   |  _ |  j j |  q# n  Pq# Wd  S| d k r |  j j |   |  _	 nX | d k r |  j j
 |   |  _	 n4 | d k r |  j j |   |  _	 n t d |   |  j	 j |  d  S(   Ni   R   R  R   R  s   Unknown component (%s)(   R   R   R   RW   R  R   R  Re   R  R  t   Listt   UnionRJ   (   R    R\   RP   Rg   R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  M  s$    R  c           B   sr   e  Z d  Z i d d 6d d 6Z i d d g e j d 6Z d Z d   Z	 d   Z
 d d	  Z d
   Z d   Z RS(   s  <restriction base>
           parents:
               simpleType
           attributes:
               id -- ID
               base -- QName, required or simpleType child

           contents:
               annotation?, simpleType?, (enumeration | length |
               maxExclusive | maxInclusive | maxLength | minExclusive |
               minInclusive | minLength | pattern | fractionDigits |
               totalDigits | whiteSpace)*
        R   R   R   R  R   R  c         C   s/   t  j |  |  d  |  _ d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#   w  s    		c         C   s   t  j |  d  S(   NR   (   R   R   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getAttributeBase}  s    c         C   s   t  j |  |  S(   N(   R   R   (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   s(   x! |  j  D] } | j   r
 | Sq
 Wd  S(   N(   R  R   R:   (   R    t   el(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getSimpleTypeContent  s    c         C   s7  g  |  _  |  j |  |  j |  } g  } x t t |   D] } t | | j    d } | d k r | r t |   |  _ |  j j	 | |  q> q> | d k r | s | d k r | j
 t |    | d j	 | |  q> | t j  k r
|  j  j
 | |  q> t d t j     q> Wt |  |  _ d  S(   Ni   R   R  is   Unknown component (%s)(   R   R   R   R`  R   R   RW   R  R   R  Rc   RT  R   RJ   R  R   R  (   R    R\   RP   R  Rb  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s"    	N(   R   R   RH   R:   RR   R   R   RP   R   R#   R  R   R  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  c  s   

			R  c           B   sM   e  Z d  Z i d	 d 6d	 d 6Z i d d g d 6Z d Z d   Z d   Z RS(
   s   <union>
           parents:
               simpleType
           attributes:
               id -- ID
               memberTypes -- list of QNames, required or simpleType child.

           contents:
               annotation?, simpleType*
        R   R   R   R  R   R  c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    	c         C   s   |  j  |  |  j |  } g  } x t t |   D] } t | | j    d } | d k r | r t |   |  _ |  j j | |  q5 | d k r | j	 t
 |    | d j | |  q5 t d t j     q5 Wt |  |  _ d  S(   Ni   R   R  is   Unknown component (%s)(   R   R   R`  R   R   RW   R  R   R  Rc   RT  RJ   R  R   R  (   R    R\   RP   R  Rb  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    N(	   R   R   RH   R:   RR   RP   R   R#   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   

	R  c           B   sb   e  Z d  Z i d d 6d d 6Z i d d g d 6Z d Z d   Z d   Z d d	  Z	 d
   Z
 RS(   s   <list>
           parents:
               simpleType
           attributes:
               id -- ID
               itemType -- QName, required or simpleType child.

           contents:
               annotation?, simpleType?
        R   R   R   R  R   R   c         C   s&   t  j |  |  d  |  _ d  |  _ d  S(   N(   R   R#   R:   R   R  (   R    R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR#     s    	c         C   s   |  j  j d  S(   NR   (   RR   R^   (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   getItemType  s    c         C   s   t  j |  |  } | p |  j S(   s   
            return the type refered to by itemType attribute or
            the simpleType content.  If returns None, then the
            type refered to by itemType is primitive.
            (   R   R   R  (   R    R   RO  (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s    c         C   s   d  |  _ d  |  _ |  j |  |  j |  } x t t |   D] } t | | j    d } | d k r | r t	 |   |  _ |  j j
 | |  qA | d k r t |   |  _ |  j j
 | |  PqA t d t j     qA Wd  S(   Ni   R   R  s   Unknown component (%s)(   R:   R   R  R   R   R`  R   R   RW   R  R  RT  RJ   R  (   R    R\   RP   Rb  R   (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s    		N(   R   R   RH   R:   RR   RP   R   R#   R  R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR    s   

			N(   R   R   RH   R   R:   RR   RP   R   R#   R   R   R  R   R   R  R   R  R   R  (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRK  ,  s"   	
				:&RT  c           B   s'   e  Z d  Z g  Z i d d 6Z d Z RS(   s   <simpleType>
       parents:
           attribute, element, list, restriction, union
       attributes:
           id -- ID

       contents:
           annotation?, (restriction | list | union)
    R   R  N(   R   R   RH   R   R:   RR   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyRT    s   t   Redefinec           B   s   e  Z d  Z d Z RS(   sD   <redefine>
       parents:
       attributes:

       contents:
    R  (   R   R   RH   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  
  s   i   R   c           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   sM   Tuple of length 2, consisting of
       a namespace and unprefixed name.
    c         C   so   t  |  d k r% t d |   n: | d j d  d k r_ | d t | d  d f } n  t j |  |  S(   sS   args -- (namespace, name)
           Remove the name's prefix, irrelevant.
        i   s)   expecting tuple (namespace, name), got %si   t   :i    (   R   R   t   findR   R   t   __new__(   t   typt   args(    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR  #  s
    !c         C   s   |  d S(   Ni    (    (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   -  s    c         C   s   |  d S(   Ni   (    (   R    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR   0  s    (   R   R   RH   R  R   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyR     s   	
	(\   t   identR   R   t   sysR?  R%  t
   NamespacesR    R   R   R   t   UtilityR   R   R   R   R   R	   t	   threadingR
   t   ImportErrorR   R   R   R   R   t   ENCRx  t   AXIS_NSR   R   R   t	   ExceptionRJ   RK   RL   R   Rv   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R   RF  RU  RY  R]  RG  Ra  Rc  Rk  Rm  Rn  RH  R  R  R  R  R  R  RI  R  RJ  R  RK  RT  R  t   version_infoR   t
   tupleClasst	   UserTupleR   (    (    (    s5   /usr/lib/python2.7/dist-packages/wstools/XMLSchema.pyt   <module>   s   "(
		l4P; :"k -.#*8*\/.:909., 		