Package xmlschema_acue :: Module xpath :: Class ElementPathMixin

Class ElementPathMixin

source code


Mixin abstract class for enabling ElementTree and XPath API on XSD components.

:cvar text: The Element text. Its value is always `None`. For compatibility with the ElementTree API. :cvar tail: The Element tail. Its value is always `None`. For compatibility with the ElementTree API.

Instance Methods
 
__getitem__(self, i) source code
 
__reversed__(self) source code
 
__len__(self) source code
Class Variables
  text = None
  tail = None
  namespaces = {}
  xpath_default_namespace = None
Method Details

__iter__(self)

source code 
Decorators:
  • @abstractmethod

tag(self)

source code 

Alias of the *name* attribute. For compatibility with the ElementTree API.

Decorators:
  • @property

attrib(self)

source code 

Returns the Element attributes. For compatibility with the ElementTree API.

Decorators:
  • @property

get(self, key, default=None)

source code 

Gets an Element attribute. For compatibility with the ElementTree API.

Decorators:

iterfind(self, path, namespaces=None)

source code 

Creates and iterator for all XSD subelements matching the path.

:param path: an XPath expression that considers the XSD component as the root element. :param namespaces: is an optional mapping from namespace prefix to full name. :return: an iterable yielding all matching XSD subelements in document order.

Decorators:

find(self, path, namespaces=None)

source code 

Finds the first XSD subelement matching the path.

:param path: an XPath expression that considers the XSD component as the root element. :param namespaces: an optional mapping from namespace prefix to full name. :return: The first matching XSD subelement or ``None`` if there is not match.

Decorators:

findall(self, path, namespaces=None)

source code 

Finds all XSD subelements matching the path.

:param path: an XPath expression that considers the XSD component as the root element. :param namespaces: an optional mapping from namespace prefix to full name. :return: a list containing all matching XSD subelements in document order, an empty list is returned if there is no match.

Decorators:

iter(self, tag=None)

source code 

Creates an iterator for the XSD element and its subelements. If tag is not `None` or '*', only XSD elements whose matches tag are returned from the iterator. Local elements are expanded without repetitions. Element references are not expanded because the global elements are not descendants of other elements.

Decorators:

iterchildren(self, tag=None)

source code 

Creates an iterator for the child elements of the XSD component. If *tag* is not `None` or '*', only XSD elements whose name matches tag are returned from the iterator.

Decorators: