An EBML Schema is a well-formed XML Document [
XML] that defines the properties, arrangement, and usage of EBML Elements that compose a specific EBML Document Type. The relationship of an EBML Schema to an EBML Document is analogous to the relationship of an XML Schema [
XML-SCHEMA] to an XML Document [
XML]. An EBML Schema
MUST be clearly associated with one or more EBML Document Types. An EBML Document Type is identified by a string stored within the EBML Header in the DocType Element -- for example, Matroska or WebM (see
Section 11.2.6). The DocType value for an EBML Document Type
MUST be unique, persistent, and described in the IANA registry (see
Section 17.2).
An EBML Schema
MUST declare exactly one EBML Element at Root Level (referred to as the Root Element) that occurs exactly once within an EBML Document. The Void Element
MAY also occur at Root Level but is not a Root Element (see
Section 11.3.2).
The EBML Schema
MUST document all Elements of the EBML Body. The EBML Schema does not document Global Elements that are defined by this document (namely, the Void Element and the CRC-32 Element).
The EBML Schema
MUST NOT use the Element ID
0x1A45DFA3, which is reserved for the EBML Header for the purpose of resynchronization.
An EBML Schema
MAY constrain the use of EBML Header Elements (see
Section 11.2) by adding or constraining that Element's
range attribute. For example, an EBML Schema
MAY constrain the EBMLMaxSizeLength to a maximum value of
8 or
MAY constrain the EBMLVersion to only support a value of
1. If an EBML Schema adopts the EBML Header Element as is, then it is not required to document that Element within the EBML Schema. If an EBML Schema constrains the range of an EBML Header Element, then that Element
MUST be documented within an
<element> node of the EBML Schema. This document provides an example of an EBML Schema; see
Section 11.1.1.
<?xml version="1.0" encoding="utf-8"?>
<EBMLSchema xmlns="urn:ietf:rfc:8794"
docType="files-in-ebml-demo" version="1">
<!-- constraints to the range of two EBML Header Elements -->
<element name="EBMLReadVersion" path="\EBML\EBMLReadVersion"
id="0x42F7" minOccurs="1" maxOccurs="1" range="1" default="1"
type="uinteger"/>
<element name="EBMLMaxSizeLength"
path="\EBML\EBMLMaxSizeLength" id="0x42F3" minOccurs="1"
maxOccurs="1" range="8" default="8" type="uinteger"/>
<!-- Root Element-->
<element name="Files" path="\Files" id="0x1946696C"
type="master">
<documentation lang="en"
purpose="definition">Container of data and
attributes representing one or many files.</documentation>
</element>
<element name="File" path="\Files\File" id="0x6146"
type="master" minOccurs="1">
<documentation lang="en" purpose="definition">
An attached file.
</documentation>
</element>
<element name="FileName" path="\Files\File\FileName"
id="0x614E" type="utf-8"
minOccurs="1">
<documentation lang="en" purpose="definition">
Filename of the attached file.
</documentation>
</element>
<element name="MimeType" path="\Files\File\MimeType"
id="0x464D" type="string"
minOccurs="1">
<documentation lang="en" purpose="definition">
MIME type of the file.
</documentation>
</element>
<element name="ModificationTimestamp"
path="\Files\File\ModificationTimestamp" id="0x4654"
type="date" minOccurs="1">
<documentation lang="en" purpose="definition">
Modification timestamp of the file.
</documentation>
</element>
<element name="Data" path="\Files\File\Data" id="0x4664"
type="binary" minOccurs="1">
<documentation lang="en" purpose="definition">
The data of the file.
</documentation>
</element>
</EBMLSchema>
Within an EBML Schema, the XPath [
XPath] of the
<EBMLSchema> element is
/EBMLSchema.
When used as an XML Document, the EBML Schema
MUST use
<EBMLSchema> as the top-level element. The
<EBMLSchema> element can contain
<element> subelements.
The namespace URI for elements of the EBML Schema is a URN as defined by [
RFC 8141] that uses the namespace identifier 'ietf' defined by [
RFC 2648] and extended by [
RFC 3688]. This URN is
urn:ietf:rfc:8794.
Within an EBML Schema, the
<EBMLSchema> element uses the following attributes to define an EBML Element:
Within an EBML Schema, the XPath of the
@docType attribute is
/EBMLSchema/@docType.
The docType lists the official name of the EBML Document Type that is defined by the EBML Schema; for example,
<EBMLSchema docType="matroska">.
The
docType attribute is
REQUIRED within the
<EBMLSchema> Element.
Within an EBML Schema, the XPath of the
@version attribute is
/EBMLSchema/@version.
The version lists a nonnegative integer that specifies the version of the docType documented by the EBML Schema. Unlike XML Schemas, an EBML Schema documents all versions of a docType's definition rather than using separate EBML Schemas for each version of a docType. EBML Elements may be introduced and deprecated by using the
minver and
maxver attributes of
<element>.
The
version attribute is
REQUIRED within the
<EBMLSchema> Element.
Within an EBML Schema, the XPath of the
@ebml attribute is
/EBMLSchema/@ebml.
The
ebml attribute is a positive integer that specifies the version of the EBML Header (see
Section 11.2.2) used by the EBML Schema. If the attribute is omitted, the EBML Header version is 1.
Within an EBML Schema, the XPath of the
<element> element is
/EBMLSchema/element.
Each
<element> defines one EBML Element through the use of several attributes that are defined in
Section 11.1.6. EBML Schemas
MAY contain additional attributes to extend the semantics but
MUST NOT conflict with the definitions of the
<element> attributes defined within this document.
The
<element> nodes contain a description of the meaning and use of the EBML Element stored within one or more
<documentation> subelements, followed by optional
<implementation_note> subelements, followed by zero or one
<restriction> subelement, followed by optional
<extension> subelements. All
<element> nodes
MUST be subelements of the
<EBMLSchema>.
Within an EBML Schema, the
<element> uses the following attributes to define an EBML Element:
Within an EBML Schema, the XPath of the
@name attribute is
/EBMLSchema/element/@name.
The name provides the human-readable name of the EBML Element. The value of the name
MUST be in the form of characters "A" to "Z", "a" to "z", "0" to "9", "-", and ".". The first character of the name
MUST be in the form of an "A" to "Z", "a" to "z", or "0" to "9" character.
The
name attribute is
REQUIRED.
Within an EBML Schema, the XPath of the
@path attribute is
/EBMLSchema/element/@path.
The path defines the allowed storage locations of the EBML Element within an EBML Document. This path
MUST be defined with the full hierarchy of EBML Elements separated with a
\. The top EBML Element in the path hierarchy is the first in the value. The syntax of the
path attribute is defined using this Augmented Backus-Naur Form (ABNF) [
RFC 5234] with the case-sensitive update [
RFC 7405] notation:
The
path attribute is
REQUIRED.
EBMLFullPath = EBMLParentPath EBMLElement
EBMLParentPath = PathDelimiter [EBMLParents]
EBMLParents = 0*IntermediatePathAtom EBMLLastParent
IntermediatePathAtom = EBMLPathAtom / GlobalPlaceholder
EBMLLastParent = EBMLPathAtom / GlobalPlaceholder
EBMLPathAtom = [IsRecursive] EBMLAtomName PathDelimiter
EBMLElement = [IsRecursive] EBMLAtomName
PathDelimiter = "\"
IsRecursive = "+"
EBMLAtomName = ALPHA / DIGIT 0*EBMLNameChar
EBMLNameChar = ALPHA / DIGIT / "-" / "."
GlobalPlaceholder = "(" GlobalParentOccurrence "\)"
GlobalParentOccurrence = [PathMinOccurrence] "-" [PathMaxOccurrence]
PathMinOccurrence = 1*DIGIT ; no upper limit
PathMaxOccurrence = 1*DIGIT ; no upper limit
The
*,
(, and
) symbols are interpreted as defined in [
RFC 5234].
The EBMLAtomName of the EBMLElement part
MUST be equal to the
@name attribute of the EBML Schema. If the EBMLElement part contains an IsRecursive part, the EBML Element can occur within itself recursively (see
Section 11.1.6.11).
The starting PathDelimiter of EBMLParentPath corresponds to the root of the EBML Document.
The
@path value
MUST be unique within the EBML Schema. The
@id value corresponding to this
@path MUST NOT be defined for use within another EBML Element with the same EBMLParentPath as this
@path.
A path with a GlobalPlaceholder as the EBMLLastParent defines a Global Element; see
Section 11.3. If the element has no EBMLLastParent part, or the EBMLLastParent part is not a GlobalPlaceholder, then the Element is not a Global Element.
The GlobalParentOccurrence part is interpreted as the number of valid EBMLPathAtom parts that can replace the GlobalPlaceholder in the path. PathMinOccurrence represents the minimum number of EBMLPathAtoms required to replace the GlobalPlaceholder. PathMaxOccurrence represents the maximum number of EBMLPathAtoms possible to replace the GlobalPlaceholder.
If PathMinOccurrence is not present, then that GlobalParentOccurrence has a PathMinOccurrence value of 0. If PathMaxOccurrence is not present, then there is no upper bound for the permitted number of EBMLPathAtoms possible to replace the GlobalPlaceholder. PathMaxOccurrence
MUST NOT have the value 0, as it would mean no EBMLPathAtom can replace the GlobalPlaceholder, and the EBMLFullPath would be the same without that GlobalPlaceholder part. PathMaxOccurrence
MUST be bigger than, or equal to, PathMinOccurrence.
For example, in
\a\(0-1\)global, the Element path
\a\x\global corresponds to an EBMLPathAtom occurrence of 1. The Element
\a\x\y\global corresponds to an EBMLPathAtom occurrence of 2, etc. In those cases,
\a\x or
\a\x\y MUST be valid paths to be able to contain the element
global.
Consider another EBML Path,
\a\(1-\)global. There has to be at least one EBMLPathAtom between the
\a\ part and
global. So the
global EBML Element cannot be found inside the
\a EBML Element, as it means the resulting path
\a\global has no EBMLPathAtom between the
\a\ and
global. However, the
global EBML Element can be found inside the
\a\b EBML Element, because the resulting path,
\a\b\global, has one EBMLPathAtom between the
\a\ and
global. Alternatively, it can be found inside the
\a\b\c EBML Element (two EBMLPathAtom), or inside the
\a\b\c\d EBML Element (three EBMLPathAtom), etc.
Consider another EBML Path,
\a\(0-1\)global. There has to be at most one EBMLPathAtom between the
\a\ part and
global. So the
global EBML Element can be found inside either the
\a EBML Element (0 EBMLPathAtom replacing GlobalPlaceholder) or the
\a\b EBML Element (one replacement EBMLPathAtom). But it cannot be found inside the
\a\b\c EBML Element, because the resulting path,
\a\b\c\global, has two EBMLPathAtom between
\a\ and
global.
Within an EBML Schema, the XPath of the
@id attribute is
/EBMLSchema/element/@id.
The Element ID is encoded as a Variable-Size Integer. It is read and stored in big-endian order. In the EBML Schema, it is expressed in hexadecimal notation prefixed by a 0x. To reduce the risk of false positives while parsing EBML Streams, the Element IDs of the Root Element and Top-Level Elements
SHOULD be at least 4 octets in length. Element IDs defined for use at Root Level or directly under the Root Level
MAY use shorter octet lengths to facilitate padding and optimize edits to EBML Documents; for instance, the Void Element uses an Element ID with a length of one octet to allow its usage in more writing and editing scenarios.
The Element ID of any Element found within an EBML Document
MUST only match a single
@path value of its corresponding EBML Schema, but a separate instance of that Element ID value defined by the EBML Schema
MAY occur within a different
@path. If more than one Element is defined to use the same
@id value, then the
@path values of those Elements
MUST NOT share the same EBMLParentPath. Elements
MUST NOT be defined to use the same
@id value if one of their common Parent Elements could be an Unknown-Sized Element.
The
id attribute is
REQUIRED.
Within an EBML Schema, the XPath of the
@minOccurs attribute is
/EBMLSchema/element/@minOccurs.
minOccurs is a nonnegative integer expressing the minimum permitted number of occurrences of this EBML Element within its Parent Element.
Each instance of the Parent Element
MUST contain at least this many instances of this EBML Element. If the EBML Element has an empty EBMLParentPath, then
minOccurs refers to constraints on the occurrence of the EBML Element within the EBML Document. EBML Elements with
minOccurs set to "1" that also have a default value (see
Section 11.1.6.8) declared are not
REQUIRED to be stored but are
REQUIRED to be interpreted; see
Section 11.1.19.
An EBML Element defined with a
minOccurs value greater than zero is called a Mandatory EBML Element.
The
minOccurs attribute is
OPTIONAL. If the
minOccurs attribute is not present, then that EBML Element has a
minOccurs value of 0.
The semantic meaning of
minOccurs within an EBML Schema is analogous to the meaning of
minOccurs within an XML Schema.
Within an EBML Schema, the XPath of the
@maxOccurs attribute is
/EBMLSchema/element/@maxOccurs.
maxOccurs is a nonnegative integer expressing the maximum permitted number of occurrences of this EBML Element within its Parent Element.
Each instance of the Parent Element
MUST contain at most this many instances of this EBML Element, including the unwritten mandatory element with a default value; see
Section 11.1.19. If the EBML Element has an empty EBMLParentPath, then
maxOccurs refers to constraints on the occurrence of the EBML Element within the EBML Document.
The
maxOccurs attribute is
OPTIONAL. If the
maxOccurs attribute is not present, then there is no upper bound for the permitted number of occurrences of this EBML Element within its Parent Element or within the EBML Document, depending on whether or not the EBMLParentPath of the EBML Element is empty.
The semantic meaning of
maxOccurs within an EBML Schema is analogous to the meaning of
maxOccurs within an XML Schema; when it is not present, it's similar to xml:maxOccurs="unbounded" in an XML Schema.
Within an EBML Schema, the XPath of the
@range attribute is
/EBMLSchema/element/@range.
A numerical range for EBML Elements that are of numerical types (Unsigned Integer, Signed Integer, Float, and Date). If specified, the value of the EBML Element
MUST be within the defined range. See
Section 11.1.6.6.1 for rules applied to expression of range values.
The
range attribute is
OPTIONAL. If the
range attribute is not present, then any value legal for the
type attribute is valid.
The
range attribute
MUST only be used with EBML Elements that are either signed integer, unsigned integer, float, or date. The expression defines the upper, lower, exact, or excluded value of the EBML Element and optionally an upper boundary value combined with a lower boundary. The range expression may contain whitespace (using the ASCII 0x20 character) for readability, but whitespace within a range expression
MUST NOT convey meaning.
To set a fixed value for the range, the value is used as the attribute value. For example,
1234 means the EBML element always has the value 1234. The value can be prefixed with
not to indicate that the fixed value
MUST NOT be used for that Element. For example,
not 1234 means the Element can use all values of its type except 1234.
The
> sign is used for an exclusive lower boundary, and the
>= sign is used for an inclusive lower boundary. For example,
>3 means the Element value
MUST be greater than 3, and
>=0x1p+0 means the Element value
MUST be greater than or equal to the floating value 1.0; see
Section 11.1.18.
The
< sign is used for an exclusive upper boundary, and the
<= sign is used for an inclusive upper boundary. For example,
<-2 means the Element value
MUST be less than -2, and
<=10 means the Element value
MUST be less than or equal to 10.
The lower and upper bounds can be combined into an expression to form a closed boundary. The lower boundary comes first, followed by the upper boundary, separated by a comma. For example,
>3,<= 20 means the Element value
MUST be greater than 3 and less than or equal to 20.
A special form of lower and upper bounds using the
- separator is possible, meaning the Element value
MUST be greater than, or equal to, the first value and
MUST be less than or equal to the second value. For example,
1-10 is equivalent to
>=1,<=10. If the upper boundary is negative, the
range attribute
MUST only use the latter form.
Within an EBML Schema, the XPath of the
@length attribute is
/EBMLSchema/element/@length.
The
length attribute is a value to express the valid length of the Element Data as written, measured in octets. The length provides a constraint in addition to the Length value of the definition of the corresponding EBML Element Type. This length
MUST be expressed as either a nonnegative integer or a range (see
Section 11.1.6.6.1) that consists of only nonnegative integers and valid operators.
The
length attribute is
OPTIONAL. If the
length attribute is not present for that EBML Element, then that EBML Element is only limited in length by the definition of the associated EBML Element Type.
Within an EBML Schema, the XPath of the
@default attribute is
/EBMLSchema/element/@default.
If an Element is mandatory (has a
minOccurs value greater than zero) but not written within its Parent Element or stored as an Empty Element, then the EBML Reader of the EBML Document
MUST semantically interpret the EBML Element as present with this specified default value for the EBML Element. An unwritten mandatory Element with a declared default value is semantically equivalent to that Element if written with the default value stored as the Element Data. EBML Elements that are Master Elements
MUST NOT declare a default value. EBML Elements with a
minOccurs value greater than 1
MUST NOT declare a default value.
The default attribute is
OPTIONAL.
Within an EBML Schema, the XPath of the
@type attribute is
/EBMLSchema/element/@type.
The type
MUST be set to one of the following values:
integer (signed integer),
uinteger (unsigned integer),
float,
string,
date,
utf-8,
master, or
binary. The content of each type is defined in
Section 7.
The
type attribute is
REQUIRED.
Within an EBML Schema, the XPath of the
@unknownsizeallowed attribute is
/EBMLSchema/element/@unknownsizeallowed.
This attribute is a boolean to express whether an EBML Element is permitted to be an Unknown-Sized Element (having all VINT_DATA bits of Element Data Size set to 1). EBML Elements that are not Master Elements
MUST NOT set
unknownsizeallowed to true. An EBML Element that is defined with an
unknownsizeallowed attribute set to 1
MUST also have the
unknownsizeallowed attribute of its Parent Element set to 1.
An EBML Element with the
unknownsizeallowed attribute set to 1
MUST NOT have its
recursive attribute set to 1.
The
unknownsizeallowed attribute is
OPTIONAL. If the
unknownsizeallowed attribute is not used, then that EBML Element is not allowed to use an unknown Element Data Size.
Within an EBML Schema, the XPath of the
@recursive attribute is
/EBMLSchema/element/@recursive.
This attribute is a boolean to express whether an EBML Element is permitted to be stored recursively. If it is allowed, the EBML Element
MAY be stored within another EBML Element that has the same Element ID, which itself can be stored in an EBML Element that has the same Element ID, and so on. EBML Elements that are not Master Elements
MUST NOT set recursive to true.
If the EBMLElement part of the
@path contains an IsRecursive part, then the
recursive value
MUST be true; otherwise, it
MUST be false.
An EBML Element with the
recursive attribute set to 1
MUST NOT have its
unknownsizeallowed attribute set to 1.
The
recursive attribute is
OPTIONAL. If the
recursive attribute is not present, then the EBML Element
MUST NOT be used recursively.
Within an EBML Schema, the XPath of the
@recurring attribute is
/EBMLSchema/element/@recurring.
This attribute is a boolean to express whether or not an EBML Element is defined as an Identically Recurring Element; see
Section 11.1.17.
The
recurring attribute is
OPTIONAL. If the
recurring attribute is not present, then the EBML Element is not an Identically Recurring Element.
Within an EBML Schema, the XPath of the
@minver attribute is
/EBMLSchema/element/@minver.
The
minver (minimum version) attribute stores a nonnegative integer that represents the first version of the docType to support the EBML Element.
The
minver attribute is
OPTIONAL. If the
minver attribute is not present, then the EBML Element has a minimum version of "1".
Within an EBML Schema, the XPath of the
@maxver attribute is
/EBMLSchema/element/@maxver.
The
maxver (maximum version) attribute stores a nonnegative integer that represents the last or most recent version of the docType to support the element.
maxver MUST be greater than or equal to
minver.
The
maxver attribute is
OPTIONAL. If the
maxver attribute is not present, then the EBML Element has a maximum version equal to the value stored in the
version attribute of
<EBMLSchema>.
Within an EBML Schema, the XPaths of the
<documentation> elements are
/EBMLSchema/element/documentation and
/EBMLSchema/element/restriction/enum/documentation.
The
<documentation> element provides additional information about EBML Elements or enumeration values. Within the
<documentation> element, the following XHTML [
XHTML] elements
MAY be used:
<a>,
<br>, and
<strong>.
Within an EBML Schema, the XPath of the
@lang attribute is
/EBMLSchema/element/documentation/@lang.
The
lang attribute is set to the value from [
RFC 5646] of the language of the element's documentation.
The
lang attribute is
OPTIONAL.
Within an EBML Schema, the XPath of the
@purpose attribute is
/EBMLSchema/element/documentation/@purpose.
A
purpose attribute distinguishes the meaning of the documentation. Values for the
<documentation> subelement's
purpose attribute
MUST include one of the values listed in
Table 8.
value of purpose attribute |
definition |
definition |
A "definition" is recommended for every defined EBML Element. This documentation explains the semantic meaning of the EBML Element. |
rationale |
An explanation about the reason or catalyst for the definition of the Element. |
usage notes |
Recommended practices or guidelines for both reading, writing, or interpreting the Element. |
references |
Informational references to support the contextualization and understanding of the value of the Element. |
Table 8: Definitions of the permitted values for the purpose attribute of the documentation Element
The
purpose attribute is
REQUIRED.
Within an EBML Schema, the XPath of the
<implementation_note> element is
/EBMLSchema/element/implementation_note.
In some cases within an EBML Document Type, the attributes of the
<element> element are not sufficient to clearly communicate how the defined EBML Element is intended to be implemented. For instance, one EBML Element might only be mandatory if another EBML Element is present. As another example, the default value of an EBML Element might be derived from a related Element's content. In these cases where the Element's definition is conditional or advanced implementation notes are needed, one or many
<implementation_note> elements can be used to store that information. The
<implementation_note> refers to a specific attribute of the parent
<element> as expressed by the
note_attribute attribute (see
Section 11.1.10.1).
Within an EBML Schema, the XPath of the
@note_attribute attribute is
/EBMLSchema/element/implementation_note/@note_attribute.
The
note_attribute attribute references which of the attributes of the
<element> the
<implementation_note> relates to. The
note_attribute attribute
MUST be set to one of the following values (corresponding to that attribute of the parent
<element>):
minOccurs,
maxOccurs,
range,
length,
default,
minver, or
maxver. The
<implementation_note> SHALL supersede the parent
<element>'s attribute that is named in the
note_attribute attribute. An
<element> SHALL NOT have more than one
<implementation_note> of the same
note_attribute.
The
note_attribute attribute is
REQUIRED.
The following fragment of an EBML Schema demonstrates how an
<implementation_note> is used. In this case, an EBML Schema documents a list of items that are described with an optional cost. The Currency Element uses an
<implementation_note> to say that the Currency Element is
REQUIRED if the Cost Element is set, otherwise not.
<element name="Items" path="\Items" id="0x4025" type="master"
minOccurs="1" maxOccurs="1">
<documentation lang="en" purpose="definition">
A set of items.
</documentation>
</element>
<element name="Item" path="\Items\Item" id="0x4026"
type="master">
<documentation lang="en" purpose="definition">
An item.
</documentation>
</element>
<element name="Cost" path="\Items\Item\Cost" id="0x4024"
type="float" maxOccurs="1">
<documentation lang="en" purpose="definition">
The cost of the item, if any.
</documentation>
</element>
<element name="Currency" path="\Items\Item\Currency" id="0x403F"
type="string" maxOccurs="1">
<documentation lang="en" purpose="definition">
The currency of the item's cost.
</documentation>
<implementation_note note_attribute="minOccurs">
Currency MUST be set (minOccurs=1) if the associated Item stores
a Cost, else Currency MAY be unset (minOccurs=0).
</implementation_note>
</element>
Within an EBML Schema, the XPath of the
<restriction> element is
/EBMLSchema/element/restriction.
The
<restriction> element provides information about restrictions to the allowable values for the EBML Element, which are listed in
<enum> elements.
Within an EBML Schema, the XPath of the
<enum> element is
/EBMLSchema/element/restriction/enum.
The
<enum> element stores a list of values allowed for storage in the EBML Element. The values
MUST match the type of the EBML Element (for example,
<enum value="Yes"> cannot be a valid value for an EBML Element that is defined as an unsigned integer). An
<enum> element
MAY also store
<documentation> elements to further describe the
<enum>.
Within an EBML Schema, the XPath of the
@label attribute is
/EBMLSchema/element/restriction/enum/@label.
The label provides a concise expression for human consumption that describes what the value of
<enum> represents.
The
label attribute is
OPTIONAL.
Within an EBML Schema, the XPath of the
@value attribute is
/EBMLSchema/element/restriction/enum/@value.
The value represents data that
MAY be stored within the EBML Element.
The
value attribute is
REQUIRED.
Within an EBML Schema, the XPath of the
<extension> element is
/EBMLSchema/element/extension.
The
<extension> element provides an unconstrained element to contain information about the associated EBML
<element>, which is undefined by this document but
MAY be defined by the associated EBML Document Type. The
<extension> element
MUST contain a
type attribute and also
MAY contain any other attribute or subelement as long as the EBML Schema remains as a well-formed XML Document. All
<extension> elements
MUST be subelements of the
<element>.
Within an EBML Schema, the XPath of the
@type attribute is
/EBMLSchema/element/extension/@type.
The
type attribute should reference a name or identifier of the project or authority associated with the contents of the
<extension> element.
The
type attribute is
REQUIRED.
The following provides an XML Schema [
XML-SCHEMA] for facilitating verification of an EBML Schema described in
Section 11.1.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="urn:ietf:rfc:8794"
targetNamespace="urn:ietf:rfc:8794"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
elementFormDefault="qualified" version="01">
<!-- for HTML in comments -->
<xs:import namespace="http://www.w3.org/1999/xhtml"
schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"/>
<xs:element name="EBMLSchema" type="EBMLSchemaType"/>
<xs:complexType name="EBMLSchemaType">
<xs:sequence>
<xs:element name="element" type="elementType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="docType" use="required"/>
<xs:attribute name="version" use="required" type="xs:integer"/>
<xs:attribute name="ebml" type="xs:positiveInteger"
default="1"/>
</xs:complexType>
<xs:complexType name="elementType">
<xs:sequence>
<xs:element name="documentation" type="documentationType"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="implementation_note" type="noteType"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="restriction" type="restrictionType"
minOccurs="0" maxOccurs="1"/>
<xs:element name="extension" type="extensionType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9A-Za-z.-]([0-9A-Za-z.-])*"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="path" use="required">
<!-- <xs:simpleType>
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]*\*[0-9]*()"/>
</xs:restriction>
</xs:simpleType> -->
</xs:attribute>
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="0x([0-9A-F][0-9A-F])+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="minOccurs" default="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxOccurs" default="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="range"/>
<xs:attribute name="length"/>
<xs:attribute name="default"/>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="integer"/>
<xs:enumeration value="uinteger"/>
<xs:enumeration value="float"/>
<xs:enumeration value="string"/>
<xs:enumeration value="date"/>
<xs:enumeration value="utf-8"/>
<xs:enumeration value="master"/>
<xs:enumeration value="binary"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="unknownsizeallowed" type="xs:boolean"
default="false"/>
<xs:attribute name="recursive" type="xs:boolean"
default="false"/>
<xs:attribute name="recurring" type="xs:boolean"
default="false"/>
<xs:attribute name="minver" default="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="maxver">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="restrictionType">
<xs:sequence>
<xs:element name="enum" type="enumType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="extensionType">
<xs:sequence>
<xs:any processContents="skip"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="type" use="required"/>
<xs:anyAttribute processContents="skip"/>
</xs:complexType>
<xs:complexType name="enumType">
<xs:sequence>
<xs:element name="documentation" type="documentationType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="label"/>
<xs:attribute name="value" use="required"/>
</xs:complexType>
<xs:complexType name="documentationType" mixed="true">
<xs:sequence>
<xs:element name="a" type="xhtml:xhtml.a.type"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="br" type="xhtml:xhtml.br.type"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="strong" type="xhtml:xhtml.strong.type"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="lang"/>
<xs:attribute name="purpose" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="definition"/>
<xs:enumeration value="rationale"/>
<xs:enumeration value="references"/>
<xs:enumeration value="usage notes"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="noteType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="note_attribute" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="minOccurs"/>
<xs:enumeration value="maxOccurs"/>
<xs:enumeration value="range"/>
<xs:enumeration value="length"/>
<xs:enumeration value="default"/>
<xs:enumeration value="minver"/>
<xs:enumeration value="maxver"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
An Identically Recurring Element is an EBML Element that
MAY occur within its Parent Element more than once, but each recurrence of it within that Parent Element
MUST be identical both in storage and semantics. Identically Recurring Elements are permitted to be stored multiple times within the same Parent Element in order to increase data resilience and optimize the use of EBML in transmission. For instance, a pertinent Top-Level Element could be periodically resent within a datastream so that an EBML Reader that starts reading the stream from the middle could better interpret the contents. Identically Recurring Elements
SHOULD include a CRC-32 Element as a Child Element; this is especially recommended when EBML is used for long-term storage or transmission. If a Parent Element contains more than one copy of an Identically Recurring Element that includes a CRC-32 Element as a Child Element, then the first instance of the Identically Recurring Element with a valid CRC-32 value should be used for interpretation. If a Parent Element contains more than one copy of an Identically Recurring Element that does not contain a CRC-32 Element, or if CRC-32 Elements are present but none are valid, then the first instance of the Identically Recurring Element should be used for interpretation.
When a float value is represented textually in an EBML Schema, such as within a default or range value, the float values
MUST be expressed as Hexadecimal Floating-Point Constants as defined in the C11 standard [
ISO9899] (see Section 6.4.4.2 on Floating Constants).
Table 9 provides examples of expressions of float ranges.
as decimal |
as Hexadecimal Floating-Point Constants |
0.0 |
0x0p+1
|
0.0-1.0 |
0x0p+1-0x1p+0
|
1.0-256.0 |
0x1p+0-0x1p+8
|
0.857421875 |
0x1.b7p-1
|
-1.0--0.857421875 |
-0x1p+0--0x1.b7p-1
|
Table 9: Example of Floating-Point values and ranges as decimal and Hexadecimal Floating-Point Constants
Within an expression of a float range, as in an integer range, the - (hyphen) character is the separator between the minimum and maximum values permitted by the range. Hexadecimal Floating-Point Constants also use a - (hyphen) when indicating a negative binary power. Within a float range, when a - (hyphen) is immediately preceded by a letter p, then the - (hyphen) is a part of the Hexadecimal Floating-Point Constant that notes negative binary power. Within a float range, when a - (hyphen) is not immediately preceded by a letter p, then the - (hyphen) represents the separator between the minimum and maximum values permitted by the range.
If a Mandatory EBML Element has a default value declared by an EBML Schema and the value of the EBML Element is equal to the declared default value, then that EBML Element is not required to be present within the EBML Document if its Parent Element is present. In this case, the default value of the Mandatory EBML Element
MUST be read by the EBML Reader, although the EBML Element is not present within its Parent Element.
If a Mandatory EBML Element has no default value declared by an EBML Schema and its Parent Element is present, then the EBML Element
MUST be present, as well. If a Mandatory EBML Element has a default value declared by an EBML Schema, and its Parent Element is present, and the value of the EBML Element is NOT equal to the declared default value, then the EBML Element
MUST be present.
Table 10 clarifies whether a Mandatory EBML Element
MUST be written, according to whether the default value is declared, the value of the EBML Element is equal to the declared default value, and/or the Parent Element is used.
Is the default value declared? |
Is the value equal to default? |
Is the Parent Element present? |
Then is storing the EBML Element REQUIRED? |
Yes |
Yes |
Yes |
No |
Yes |
Yes |
No |
No |
Yes |
No |
Yes |
Yes |
Yes |
No |
No |
No |
No |
n/a |
Yes |
Yes |
No |
n/a |
No |
No |
Table 10: Demonstration of the conditional requirements of VINT Storage
This document contains definitions of all EBML Elements of the EBML Header.
-
name:
-
EBML
-
path:
-
\EBML
-
id:
-
0x1A45DFA3
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
type:
-
Master Element
-
description:
-
Set the EBML characteristics of the data to follow. Each EBML Document hasto start with this.
-
name:
-
EBMLVersion
-
path:
-
\EBML\EBMLVersion
-
id:
-
0x4286
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
range:
-
not 0
-
default:
-
1
-
type:
-
Unsigned Integer
-
description:
-
The version of EBML specifications used to create the EBML Document. Theversion of EBML defined in this document is 1, so EBMLVersionSHOULD be 1.
-
name:
-
EBMLReadVersion
-
path:
-
\EBML\EBMLReadVersion
-
id:
-
0x42F7
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
range:
-
1
-
default:
-
1
-
type:
-
Unsigned Integer
-
description:
-
The minimum EBML version an EBML Reader has to support to read this EBMLDocument. The EBMLReadVersion Element MUST be less than or equal to EBMLVersion.
-
name:
-
EBMLMaxIDLength
-
path:
-
\EBML\EBMLMaxIDLength
-
id:
-
0x42F2
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
range:
-
>=4
-
default:
-
4
-
type:
-
Unsigned Integer
-
description:
-
The EBMLMaxIDLength Element stores the maximum permitted length in octetsof the Element IDs to be found within the EBML Body. An EBMLMaxIDLength Element value of fouris RECOMMENDED, though larger values are allowed.
-
name:
-
EBMLMaxSizeLength
-
path:
-
\EBML\EBMLMaxSizeLength
-
id:
-
0x42F3
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
range:
-
not 0
-
default:
-
8
-
type:
-
Unsigned Integer
-
description:
-
The EBMLMaxSizeLength Element stores the maximum permitted length inoctets of the expressions of all Element Data Sizes to be found within the EBML Body. TheEBMLMaxSizeLength Element documents an upper bound for the length ofall Element Data Size expressions within the EBML Body and not an upper boundfor the value of all Element Data Size expressionswithin the EBML Body. EBML Elements that have an Element Data Size expression that is larger in octetsthan what is expressed by EBMLMaxSizeLength Element are invalid.
-
name:
-
DocType
-
path:
-
\EBML\DocType
-
id:
-
0x4282
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
length:
-
>0
-
type:
-
String
-
description:
-
A string that describes and identifies the content of the EBML Body thatfollows this EBML Header.
-
name:
-
DocTypeVersion
-
path:
-
\EBML\DocTypeVersion
-
id:
-
0x4287
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
range:
-
not 0
-
default:
-
1
-
type:
-
Unsigned Integer
-
description:
-
The version of DocType interpreter used to create the EBML Document.
-
name:
-
DocTypeReadVersion
-
path:
-
\EBML\DocTypeReadVersion
-
id:
-
0x4285
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
range:
-
not 0
-
default:
-
1
-
type:
-
Unsigned Integer
-
description:
-
The minimum DocType version an EBML Reader has to support to read thisEBML Document. The value of the DocTypeReadVersion Element MUSTbe less than or equal to the value of the DocTypeVersion Element.
-
name:
-
DocTypeExtension
-
path:
-
\EBML\DocTypeExtension
-
id:
-
0x4281
-
minOccurs:
-
0
-
type:
-
Master Element
-
description:
-
A DocTypeExtension adds extra Elements to the main DocType+DocTypeVersiontuple it's attached to. An EBML Reader MAY know these extra Elements and howto use them. A DocTypeExtension MAY be used to iterate betweenexperimental Elements before they are integrated into a regularDocTypeVersion. Reading one DocTypeExtension version of aDocType+DocTypeVersion tuple doesn't imply one should be able to read upperversions of this DocTypeExtension.
-
name:
-
DocTypeExtensionName
-
path:
-
\EBML\DocTypeExtension\DocTypeExtensionName
-
id:
-
0x4283
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
length:
-
>0
-
type:
-
String
-
description:
-
The name of the DocTypeExtension to differentiate it from otherDocTypeExtensions of the same DocType+DocTypeVersion tuple. A DocTypeExtensionName valueMUST be unique within the EBML Header.
-
name:
-
DocTypeExtensionVersion
-
path:
-
\EBML\DocTypeExtension\DocTypeExtensionVersion
-
id:
-
0x4284
-
minOccurs:
-
1
-
maxOccurs:
-
1
-
range:
-
not 0
-
type:
-
Unsigned Integer
-
description:
-
The version of the DocTypeExtension. Different DocTypeExtensionVersionvalues of the same DocType + DocTypeVersion + DocTypeExtensionName tupleMAY contain completely different sets of extra Elements. AnEBML Reader MAY support multiple versionsof the same tuple, only one version of the tuple, or not support the tuple at all.
EBML allows some special Elements to be found within more than one parent in an EBML Document or optionally at the Root Level of an EBML Body. These Elements are called Global Elements. There are two Global Elements that can be found in any EBML Document: the CRC-32 Element and the Void Element. An EBML Schema
MAY add other Global Elements to the format it defines. These extra elements apply only to the EBML Body, not the EBML Header.
Global Elements are EBML Elements whose EBMLLastParent part of the path has a GlobalPlaceholder. Because it is the last Parent part of the path, a Global Element might also have EBMLParentPath parts in its path. In this case, the Global Element can only be found within this EBMLParentPath path -- i.e., it's not fully "global".
A Global Element can be found in many Parent Elements, allowing the same number of occurrences in each Parent where this Element is found.
-
name:
-
CRC-32
-
path:
-
\(1-\)CRC-32
-
id:
-
0xBF
-
minOccurs:
-
0
-
maxOccurs:
-
1
-
length:
-
4
-
type:
-
Binary
-
description:
-
The CRC-32 Element contains a 32-bit Cyclic Redundancy Check value of allthe Element Data of the Parent Element as stored except for the CRC-32 Elementitself. When the CRC-32 Element is present, the CRC-32 ElementMUST be the first ordered EBML Element within its ParentElement for easier reading. All Top-Level Elements of an EBML Document thatare Master Elements SHOULD include a CRC-32 Element as a ChildElement. The CRC in use is the IEEE-CRC-32 algorithm as used in the[ISO3309] standard and in Section 8.1.1.6.2 of[ITU.V42], with initial value of 0xFFFFFFFF. The CRC valueMUST be computed on a little-endian bytestream andMUST use little-endian storage.
-
name:
-
Void
-
path:
-
\(-\)Void
-
id:
-
0xEC
-
minOccurs:
-
0
-
type:
-
Binary
-
description:
-
Used to void data or to avoid unexpected behaviors when using damageddata. The content is discarded. Also used to reserve space in a subelement forlater use.