Package xmlschema_acue :: Package validators :: Module models :: Class ModelVisitor

Class ModelVisitor

source code


A visitor design pattern class that can be used for validating XML data related to an XSD model group. The visit of the model is done using an external match information, counting the occurrences and yielding tuples in case of model's item occurrence errors. Ends setting the current element to `None`.

:param root: the root ModelGroup instance of the model. :ivar occurs: the Counter instance for keeping track of occurrences of XSD elements and groups. :ivar element: the current XSD element, initialized to the first element of the model. :ivar broken: a boolean value that records if the model is still usable. :ivar group: the current XSD model group, initialized to *root* argument. :ivar iterator: the current XSD group iterator. :ivar items: the current XSD group unmatched items. :ivar match: if the XSD group has an effective item match.

Instance Methods
 
__init__(self, root) source code
 
__unicode__(self) source code
 
__str__(self) source code
 
__repr__(self) source code
 
__getitem__(self, i) source code
 
__setitem__(self, i, item) source code
 
__delitem__(self, i) source code
 
__len__(self) source code
 
insert(self, i, item) source code
 
clear(self) source code
 
restart(self) source code
 
stop(self) source code
Method Details

expected(self)

source code 

Returns the expected elements of the current and descendant groups.

Decorators:
  • @property

advance(self, match=False)

source code 

Generator function for advance to the next element. Yields tuples with particles information when occurrence violation is found.

:param match: provides current element match.

Decorators: