This module contains classes for a very simple validation model. Validation is specified like this: class inner(xsc.Element): model = sims.NoElements() class outer(xsc.Element): model = sims.Elements(inner) With this configuration ``inner`` elements may only contain text and ``outer`` elements may only contain ``inner`` elements. Everything else will issue warnings when parsing or publishing. ================================================ class ``SIMSWarning``​(``ll.xist.xsc.Warning``): ================================================ Base class for all warning classes in this module. def ``__hash__``​(``self``): ---------------------------- def ``__eq__``​(``self``, ``other``): ------------------------------------- =========================================================== class ``EmptyElementWithContentWarning``​(``SIMSWarning``): =========================================================== Warning that is issued when an element has content, but it shouldn't (i.e. ``model`` is ``Empty``) def ``__init__``​(``self``, ``path``): -------------------------------------- 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``, ``path``, ``badnode``): --------------------------------------------------- def ``__str__``​(``self``): --------------------------- =========================================== class ``ElementWarning``​(``SIMSWarning``): =========================================== Warning that is issued when an element contains another element but shouldn't contain any. def ``__init__``​(``self``, ``path``, ``badnode``): --------------------------------------------------- def ``__str__``​(``self``): --------------------------- =============================================== class ``IllegalTextWarning``​(``SIMSWarning``): =============================================== Warning that is issued when an element contains a text node but shouldn't. def ``__init__``​(``self``, ``path``, ``badnode``): --------------------------------------------------- def ``__str__``​(``self``): --------------------------- ======================================= class ``AnyWarning``​(``SIMSWarning``): ======================================= Warning that is issued when an element contains a text node but shouldn't. def ``__init__``​(``self``, ``path``, ``warnings``): ---------------------------------------------------- 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 ``validate``​(``self``, ``path``): -------------------------------------- =================================== class ``Transparent``​(``object``): =================================== This validator implements the "transparent" content model of HTML5. def ``validate``​(``self``, ``path``): -------------------------------------- ================================== class ``NoElements``​(``object``): ================================== This validator checks that an element does not have child elements from the same namespace. def ``__repr__``​(``self``): ---------------------------- def ``validate``​(``self``, ``path``): -------------------------------------- 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 ``validate``​(``self``, ``path``): -------------------------------------- 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 ``validate``​(``self``, ``path``): -------------------------------------- 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 ``validate``​(``self``, ``path``): -------------------------------------- Check that the content of ``node`` is valid. =================================== class ``NotElements``​(``object``): =================================== This validator checks that an element doesn't contain any of the specified elements. def ``__init__``​(``self``, *``elements``): ------------------------------------------- Every element in ``elements`` may not be in the content of the node to which this validator is attached. def ``__repr__``​(``self``): ---------------------------- def ``validate``​(``self``, ``path``): -------------------------------------- =========================== class ``All``​(``object``): =========================== This meta validator checks that all its child validators declare the content of the element to be valid. def ``__init__``​(``self``, *``validators``): --------------------------------------------- def ``__repr__``​(``self``): ---------------------------- def ``validate``​(``self``, ``path``): -------------------------------------- =========================== class ``Any``​(``object``): =========================== This meta validator checks that at least one of its child validators declares the content of the element to be valid. def ``__init__``​(``self``, *``validators``): --------------------------------------------- def ``__repr__``​(``self``): ---------------------------- def ``validate``​(``self``, ``path``): --------------------------------------