Next / Previous / Contents / TCC Help System / NM Tech homepage

7.7. The QName() constructor

When you are working with multiple namespaces, the QName object is useful for combining the “namespace URI” part with the “local name” part. A QName instance can be used for the name part of attributes that are in a different namespace than their containing element.

Although it is not legal in XML element names, there is a convention called “Clark notation” (after James Clark) that combines these two parts in a string of this form:


To construct a new QName instance, use a statement of this general form:

etree.QName(text, tag=none)

Here are two examples for creating a QName instance representing a qualified name in the XSLT namespace with a local name of template: