xml.Element

An Element object represents an XML element information item.

class xml.Element

Attributes

xml.Element.attributes

An unordered set of attribute information items, one for each of the attributes (specified or defaulted from the DTD) of this element. Namespace declarations do not appear in this set. If the element has no attributes, this set has no members.

xml.Element.base_URI

The base URI of the element.

xml.Element.children

An ordered list of child information items, in document order. This list contains element, processing instruction, unexpanded entity reference, character, and comment information items, one for each element, processing instruction, reference to an unprocessed external entity, data character, and comment appearing immediately within the current element. If the element is empty, this list has no members.

xml.Element.inscope_namespaces

An unordered set of namespace information items, one for each of the namespaces in effect for this element. This set always contains an item with the prefix xml which is implicitly bound to the namespace name http://www.w3.org/XML/1998/namespace. It does not contain an item with the prefix xmlns (used for declaring namespaces), since an application can never encounter an element or attribute with that prefix. The set will include namespace items corresponding to all of the members of namespace_attributes, except for any representing declarations of the form xmlns=”” or xmlns:name=”“, which do not declare a namespace but rather undeclare the default namespace and prefixes. When resolving the prefixes of qualified names this attribute should be used in preference to the namespace_attributes attribute

xml.Element.local_name

The local part of the element-type name. This does not include any namespace prefix or following colon.

xml.Element.namespace_attributes

An unordered set of attribute information items, one for each of the namespace declarations (specified or defaulted from the DTD) of this element. Declarations of the form xmlns=”” and xmlns:name=”“, which undeclare the default namespace and prefixes respectively, count as namespace declarations. Prefix undeclaration was added in Namespaces in XML 1.1. By definition, all namespace attributes (including those named xmlns, whose prefix attribute has no value) have a namespace URI of http://www.w3.org/2000/xmlns/. If the element has no namespace declarations, this set has no members.

xml.Element.namespace_name

The namespace name, if any, of the element type. If the element does not belong to a namespace, this attribute is None.

xml.Element.parent

The document or element information item which contains this information item in its children attribute.

xml.Element.prefix

The namespace prefix part of the element-type name. If the name is unprefixed, this attribute is None.

Methods

xml.Element.charnodes(bRecursive=True)
xml.Element.find_attribute(name, namespace_name=None)
xml.Element.find_child_element(name, namespace_name=None)
xml.Element.find_inscope_namespace(prefix)

Special methods

__bool__, __eq__, __ge__, __gt__, __le__, __lt__, __ne__