XIST.sims

Simple schema validation

Home › Python software › ll.xist › simsText · XIST · Python

This module contains classes for a very simple validation model.

class SIMSWarning​(ll.xist.xsc.Warning):

Base class for all warning classes in this module.

class EmptyElementWithContentWarning​(SIMSWarning):

Warning that is issued when an element has content, but it shouldn't (i.e. model is Empty)

def __init__​(self, node):

def __str__​(self):

class WrongElementWarning​(SIMSWarning):

Warning that is issued when an element contains another element of a certain type, but shouldn't.

def __init__​(self, node, badnode, elements):

def __str__​(self):

class ElementWarning​(SIMSWarning):

Warning that is issued when an element contains another element but shouldn't contain any.

def __init__​(self, node, badnode):

def __str__​(self):

class IllegalTextWarning​(SIMSWarning):

Warning that is issued when an element contains a text node but shouldn't.

def __init__​(self, node, badnode):

def __str__​(self):

def badtext​(node):

Return whether node is a text node (i.e. ll.xist.xsc.Text that does not consist of whitespace only).

class Empty​(object):

This validator checks that an element has no content.

def __repr__​(self):

def checkvalid​(self, node):

check that the content of node is valid.

class NoElements​(object):

This validator checks that an element does not have child elements from the same namespace.

def __repr__​(self):

def checkvalid​(self, node):

check that the content of node is valid.

class NoElementsOrText​(object):

This validator checks that an element does have neither child elements from the same namespace nor real (i.e. not-whitespace) text nodes.

def __repr__​(self):

def checkvalid​(self, node):

check that the content of node is valid.

class Elements​(object):

This validator checks that an element does have neither child elements from any of the namespaces of those elements specified in the constructor except for those elements itself nor real (i.e. not-whitespace) text nodes.

def __init__​(self, *elements):

Every element in elements may be in the content of the node to which this validator is attached. Any other element from one of the namespaces of those elements is invalid. Elements from other namespaces are OK.

def __repr__​(self):

def checkvalid​(self, node):

check that the content of node is valid.

class ElementsOrText​(Elements):

This validator checks that an element doesn't have child elements from the same namespace except those specified in the constructor.

def __init__​(self, *elements):

Every element in elements may be in the content of the node to which this validator is attached. Any other element from one of the namespaces of those elements is invalid. Elements from other namespaces are OK.

def __repr__​(self):

def checkvalid​(self, node):

Check that the content of node is valid.

class Any​(object):

This validator declares any content to be valid.

def __repr__​(self):

def checkvalid​(self, node):

Check that the content of node is valid. This method does nothing as anything is valid.