Warning:
This wiki has been archived and is now read-only.
MicroExamplotron
Introduction
Examplotron is a schema language for XML that uses instance documents as a lightweight iconic schema language. Basically, an instance is a schema for a simple Russian-doll document type (without recursion).
Examplotron's extended features are based on adding attributes and elements (called markers here) in the eg: namespace. Since MicroXML doesn't have namespaces, the eg: prefix is replaced by eg.., on the assumption that such names are unlikely to be used in MicroXML documents. For consistency, this change is made here in attribute values as well as names.
Rather than redefining Examplotron here, I list its features and specify which ones I think ought to be included.
Features
Here are the Examplotron base features (no markers) that MicroExamplotron supports:
- Elements represent themselves and are mandatory in the instance.
- Attributes not beginning with
eg..represent themselves and are optional in the instance. - Consecutively repeated elements indicate a "one or more" repetition (the content of all but the first is ignored).
- Character content without child elements means that the element may contain character content only.
- Mixed content means that character content is allowed and the child elements may be repeated and may appear in any order.
- The following element content and attribute values specify a simple type:
- The values
trueandfalsemean a boolean value. - An integer literal means an integer value.
- An floating-point literal means an IEEE 64-bit float value.
- An ISO date literal like
0001-01-01means a date value. - An ISO time literal like
00:00:00means a time value. - An ISO date and time literal like
0001-01-01T00:00:00means a date-time value. - The value
{dtd:ID}indicates an ID (all values in the instance must be distinct). - The value
{dtd:IDREF}indicates an IDREF (the value must be the same as the value of some ID).
- The values
Here are the Examplotron markers that MicroExamplotron supports:
- The
eg..occursattribute specifies finer control of repetition:-
*value means "zero or more". -
+value means "one or more" (same as repeated elements). -
?value means "optional". -
-value means "exactly zero" (can be used for annotations, or on dummy elements that contain named types). -
.value means "exactly one".
-
- The
eg..defineattribute names the content type of a particular element; creates a reusable element type, allowing an escape from the Russian-doll pattern. - The
eg..contentattribute specifies a defined name to show that the element has the named type.
Non-features
Here are the Examplotron base features (no markers) that MicroExamplotron does not support:
- The value
{dtd:IDREFS}indicates an IDREFS.
- The value
- An attribute type can be specified by giving an XSD simple type name in braces such as
{xsd:token}as the attribute value. - A numeric literal with a decimal point but no exponent means a decimal value.
Here are the Examplotron markers that MicroExamplotron does not support:
- The
eg..contentattribute can specify how the child elements of an element with complex type are ordered:-
eg..groupto specify order as stated (default for element-only content). -
eg..mixedto specify mixed content (default for mixed content) -
eg..interleaveto specify any order is allowed, but no text.
-
- The
eg..contentattribute can specify the simple type or IDness (see above) of an element; no braces are used. - The
eg..attributeelement can specify the detailed requirements of an attribute (mandatory by default). Its attributes are:-
namespecifies the name of the attribute. -
eg..occursspecifies-or.or?. -
eg..contentspecifies a simple type or IDness; no braces are used.
-
- The
eg..assertattribute can specify XPaths that must be true for the document to be valid.