YODEL Tags
The YODEL dialect consists of three XML tags. All Tag and Attribute names are lowercase. Attributes may be double or single quoted.
The <yodel> Tag
The <yodel> tag is the root tag ("envelope" or "wrapper") of a YODEL packet. All YODEL content is contained within the <yodel> tag.
The <yodel> tag has no custom attributes. However you may use the standard xmlns:xsi and xsi:noNamespaceSchemaLocation attributes to declare the namespace and take advantage of XSD validation. An example of this is:
<yodel
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="[XSD URL]">
</yodel>
The YODEL XSD is available. It's recommended that you copy the XSD to your own server (and modify the xsi:noNamespaceSchemaLocation attribute accordingly) if you want to use schema validation in your own applications.
Attributes
The <yodel> tag has no custom attributes.
Structural Rules
- The <yodel> tag appears once, and only once, in a YODEL packet.
- The <yodel> tag cannot be contained within any other tag.
- The <yodel> tag may contain any number or zero <md> tags.
- The <yodel> must contain one <d> tag. This <d> tag must be last child tag (it must appear after any <md> tags).
The <md> Tag
The <md> (or "MetaData") tag contains descriptive information which can be later applied to labeled data items. Although essentially optional using the <md> tag wisely can dramatically reduce the size of your data packets.
Attributes
- name: A text label identifying the metadata. Within a packet each instance of the <md> tag must have a unique name.
Structural Rules
- The <md> tag can only be contained within a <yodel> tag.
- The <md> tag may contain one, and only one, <d> tag.
Examples
The following shows the metadata declaration for a simple object:
<md name="MyObject">
<d type="object" fields="prop1, prop2">
<d type="string" />
<d type="string" />
</d>
</md>
The <d> Tag
The <d> (or "Data") tag represents all data in the packet. By nesting <d> tags you can easily represent complex data structures of many types.
Attributes
- metadata: A text label corresponding to the name attribute of a <md> tag. The same metadata name can be used for multiple <d> tags.
- type: The type of data the <d> tag represents. This can be any one of the following values: "object", "array", "null", "undefined", "string", "number", "boolean", "date", or "binary". If no type is provided the tag will be treated as type "string".
- fields: This is a comma-separated list of the fields. For data of type "object" this is list of property (or key) names. For data of type "array" this is optional (using it enables the representation of hash tables and sparse arrays); if not present simple integer indexes will be generated. For all other data types the fields attribute is ignored.
- custom: This field is provided to enable simple extension of the dialect via custom information. See the discussion on Extending YODEL for more information. Parsers should respect that it may exist but need take no action based on its presence or value.
Structural Rules
The <d> tag has these relationships with other tags:
- The <d> tag appears once, and only once, in a <yodel> tag.
- The <d> tag may contain only other <d> tags.
- The <d> tag can contain any number of <d> tags nested as deeply as is required.
Examples
A simple string:
<d type="string">This is String Content</d>
A simple object linked to declared metadata:
<d metadata="MyObject">
<d>Value One</d>
<d>Value Two</d>
</d>
An array containing two simple objects:
<d type="array">
<d metadata="MyObject">
<d>val1</d>
<d>val2</d>
</d>
<d metadata="MyObject">
<d>val1</d>
<d>val2</d>
</d>
</d>
Next we'll explore the provided data types in more detail.