Package genshi :: Module core :: Class QName

Class QName

object --+        
         |        
basestring --+    
             |    
       unicode --+
                 |
                QName

A qualified element or attribute name.

The unicode value of instances of this class contains the qualified name of the element or attribute, in the form {namespace-uri}local-name. The namespace URI can be obtained through the additional namespace attribute, while the local name can be accessed through the localname attribute.

>>> qname = QName('foo')
>>> qname
QName('foo')
>>> qname.localname
u'foo'
>>> qname.namespace
>>> qname = QName('http://www.w3.org/1999/xhtml}body')
>>> qname
QName('http://www.w3.org/1999/xhtml}body')
>>> qname.localname
u'body'
>>> qname.namespace
u'http://www.w3.org/1999/xhtml'
Instance Methods
 
__getnewargs__(self)
 
__repr__(self)
repr(x)

Inherited from unicode: __add__, __contains__, __eq__, __format__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __hash__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __rmod__, __rmul__, __sizeof__, __str__, capitalize, center, count, decode, encode, endswith, expandtabs, find, format, index, isalnum, isalpha, isdecimal, isdigit, islower, isnumeric, isspace, istitle, isupper, join, ljust, lower, lstrip, partition, replace, rfind, rindex, rjust, rpartition, rsplit, rstrip, split, splitlines, startswith, strip, swapcase, title, translate, upper, zfill

Inherited from object: __delattr__, __init__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Static Methods
a new object with type S, a subtype of T
__new__(cls, qname)
Create the QName instance.
Properties
  localname
  namespace

Inherited from object: __class__

Method Details

__new__(cls, qname)
Static Method

 
Create the QName instance.
Parameters:
  • qname - the qualified name as a string of the form {namespace-uri}local-name, where the leading curly brace is optional
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__getnewargs__(self)

 
Overrides: unicode.__getnewargs__

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)