Metadata

Allows the storage and association of metadata with the parent tag. The metadata tag does not produce any visible pixels in the scene. It is used to store complex data structures. The entire set of metadata for a tag can be accessed through XSeen’s API method tag.getMetadata(). Metadata tags can be arranged heiracharically to create a metadata object. The discussion after the attribute descriptions illustrates this.

  • name – The name of the metadata element. This field is optional. If a value is not provided, then this metadata element is only accessible through its index.
  • value – The value of this metadata element. The default is the empty string. If this metadata tag has children, this is the value at index 0.

This dicussion will use the XSeen tag group to illustrate the structure of metadata as returned by group.getMetadata(). For the XSeen fragment:

<group id='ExampleMetadata'>
  <metadata name='c1' value='1'></metadata>
  <metadata name='c2'>
    <metadata name='c2.1' value='-1'></metadata>
    <metadata name='c2.2' value='test'></metadata>
    <metadata value='no name'></metadata>
  </metadata>
    <metadata name='c3' value='label1'></metadata>
    <metadata name='c3.1' value='-1'></metadata>
    <metadata name='c3.2' value='test'></metadata>
  </metadata>
</group>

Using the XSeen method that is automatically created for each tag .getMetadata:

element = document.getElementById ('ExampleMetadata');
metadata = element.getMetaData();
/**
 * metadata has this structure (as expressed in JSON)
 * metadata = [
 *              0: '1',
 *              1: [
 *                   0:      '',
 *                   1:      '-1',
 *                   2:      'test',
 *                   3:      'no name',
 *                   'c2.1': (reference to metadata[1][1]),
 *                   'c2.2': (reference to metadata[1][2]),
 *                 ],
 *              2: [
 *                   0:      'label1'
 *                   1:      '-1',
 *                   2:      'test',
 *                   'c3.1': (reference to metadata[2][1]),
 *                   'c3.2': (reference to metadata[2][2]),
 *                 ],
 *              'c1': (reference to metadata[0]),
 *              'c2': (reference to metadata[1]),
 *              'c3': (reference to metadata[2]),
 *            ];
 */