Class Namespace
object --+
         |
        Namespace
Utility class creating and testing elements with a namespace.
Internally, namespace URIs are encoded in the QName of any element or
attribute, the namespace URI being enclosed in curly braces. This class
helps create and test these strings.
A Namespace object is instantiated with the namespace URI.
>>> html = Namespace('http://www.w3.org/1999/xhtml')
>>> html
Namespace('http://www.w3.org/1999/xhtml')
>>> html.uri
u'http://www.w3.org/1999/xhtml'
The Namespace object can than be used to generate QName objects with
that namespace:
>>> html.body
QName('http://www.w3.org/1999/xhtml}body')
>>> html.body.localname
u'body'
>>> html.body.namespace
u'http://www.w3.org/1999/xhtml'
The same works using item access notation, which is useful for element or
attribute names that are not valid Python identifiers:
>>> html['body']
QName('http://www.w3.org/1999/xhtml}body')
A Namespace object can also be used to test whether a specific QName
belongs to that namespace using the in operator:
>>> qname = html.body
>>> qname in html
True
>>> qname in Namespace('http://www.w3.org/2002/06/xhtml2')
False
    |  |  | 
    |  |  | 
    |  |  | 
    |  | 
        
          | __init__(self,
        uri) x.__init__(...) initializes x; see help(type(x)) for signature
 |  |  | 
    |  | 
        
          | __contains__(self,
        qname) |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
  
    | Inherited from object:__delattr__,__format__,__getattribute__,__reduce__,__reduce_ex__,__setattr__,__sizeof__,__subclasshook__ | 
    | a new object with type S, a subtype of T |  | 
  
    | Inherited from object:__class__ | 
| 
  | __new__(cls,
        uri)
    Static Method
 |  |  
    Returns: a new object with type S, a subtype of TOverrides:
        object.__new__
        (inherited documentation) | 
 
| 
  x.__init__(...) initializes x; see help(type(x)) for signature| __init__(self,
        uri)
    (Constructor)
 |  |  
    Overrides:
        object.__init__
        (inherited documentation) | 
 
| 
  hash(x)| __hash__(self)
    (Hashing function)
 |  |  
    Overrides:
        object.__hash__
        (inherited documentation) | 
 
| 
  repr(x)| __repr__(self)
    (Representation operator)
 |  |  
    Overrides:
        object.__repr__
        (inherited documentation) | 
 
| 
  str(x)| __str__(self)
    (Informal representation operator)
 |  |  
    Overrides:
        object.__str__
        (inherited documentation) |