MicroExamplotron

From MicroXML Community Group
Jump to: navigation, search

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 true and false mean 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-01 means a date value.
    • An ISO time literal like 00:00:00 means a time value.
    • An ISO date and time literal like 0001-01-01T00:00:00 means 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).


Here are the Examplotron markers that MicroExamplotron supports:

  • The eg..occurs attribute 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..define attribute names the content type of a particular element; creates a reusable element type, allowing an escape from the Russian-doll pattern.
  • The eg..content attribute 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.
  • 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..content attribute can specify how the child elements of an element with complex type are ordered:
    • eg..group to specify order as stated (default for element-only content).
    • eg..mixed to specify mixed content (default for mixed content)
    • eg..interleave to specify any order is allowed, but no text.
  • The eg..content attribute can specify the simple type or IDness (see above) of an element; no braces are used.
  • The eg..attribute element can specify the detailed requirements of an attribute (mandatory by default). Its attributes are:
    • name specifies the name of the attribute.
    • eg..occurs specifies - or . or ?.
    • eg..content specifies a simple type or IDness; no braces are used.
  • The eg..assert attribute can specify XPaths that must be true for the document to be valid.