sims – Simple schema validation
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.
- exception ll.xist.sims.SIMSWarning[source]
Bases:
ll.xist.xsc.WarningBase class for all warning classes in this module.
- exception ll.xist.sims.EmptyElementWithContentWarning[source]
Bases:
ll.xist.sims.SIMSWarningWarning that is issued when an element has content, but it shouldn’t (i.e.
modelisEmpty)
- exception ll.xist.sims.WrongElementWarning[source]
Bases:
ll.xist.sims.SIMSWarningWarning that is issued when an element contains another element of a certain type, but shouldn’t.
- exception ll.xist.sims.ElementWarning[source]
Bases:
ll.xist.sims.SIMSWarningWarning that is issued when an element contains another element but shouldn’t contain any.
- exception ll.xist.sims.IllegalTextWarning[source]
Bases:
ll.xist.sims.SIMSWarningWarning that is issued when an element contains a text node but shouldn’t.
- exception ll.xist.sims.AnyWarning[source]
Bases:
ll.xist.sims.SIMSWarningWarning that is issued when an element contains a text node but shouldn’t.
- ll.xist.sims.badtext(node)[source]
Return whether
nodeis a text node (i.e.ll.xist.xsc.Textthat does not consist of whitespace only).
- class ll.xist.sims.Empty[source]
Bases:
objectThis validator checks that an element has no content.
- class ll.xist.sims.Transparent[source]
Bases:
objectThis validator implements the “transparent” content model of HTML5.
- class ll.xist.sims.NoElements[source]
Bases:
objectThis validator checks that an element does not have child elements from the same namespace.
- validate(path)[source]
check that the content of
nodeis valid.
- class ll.xist.sims.NoElementsOrText[source]
Bases:
objectThis validator checks that an element does have neither child elements from the same namespace nor real (i.e. not-whitespace) text nodes.
- validate(path)[source]
check that the content of
nodeis valid.
- class ll.xist.sims.Elements[source]
Bases:
objectThis 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.
- __init__(*elements)[source]
Every element in
elementsmay 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.
- validate(path)[source]
check that the content of
nodeis valid.
- class ll.xist.sims.ElementsOrText[source]
Bases:
ll.xist.sims.ElementsThis validator checks that an element doesn’t have child elements from the same namespace except those specified in the constructor.
- __init__(*elements)[source]
Every element in
elementsmay 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.
- validate(path)[source]
Check that the content of
nodeis valid.
- class ll.xist.sims.NotElements[source]
Bases:
objectThis validator checks that an element doesn’t contain any of the specified elements.
- __init__(*elements)[source]
Every element in
elementsmay not be in the content of the node to which this validator is attached.