XOD (XML Object Description) is a VOS FileFormat. It's an XML language for describing Vobjects and their relations. It's used for omnivos configuration files, and generally to serialize Vobjects to a human editable file. (The alternative COD (Compact Object Description) is a compact binary format). the 'VobjectStore' class in libvos can load XOD files and create Vobjects from them.
There is an XML schema definition for XOD in the source code "doc" directory (XOD.xsd).
For ideas on enhancing XOD and its interpretation, see XodEnhancementIdeas.
Description of the XOD format:
Since XOD is an XML format, all XOD files must start with an XML header:
<xml version="1.0" ?>
Comments:
<!-- this is an XML comment -->
The root element of a XOD document is site:
<site> </site>
Vobjects and inter-object links
To define a vobject that should be created, use the vobject element. You must give it a name. You can also list types.
<vobject name="example1" type="type1,type2"> </vobject>
You can create child links with the link element. name and ref are required.
<vobject name="example2"> <link name="child" ref="/example" /> </vobject>
Or, you can nest vobject tags to simultaneously create a new Vobject and make a child link from its parent:
<vobject name="example3"> <vobject name="example4"> </vobject> </vobject>
Or, you can use the child tag (same effect as using vobject):
<vobject name="example3a"> <child name="example4a"> </child> <child name="example5a"> </child> </vobject>
Specifying properties
You can use the property tag to create a vobject with the property:property type, and give it a value:
<property name="exampleproperty">This is an example property.</property>
It can also be nested inside vobject or child:
<vobject name="example6">
<property name="exprop2">Example property 2</property>
<child name="example7">
<property name="exprop3">Example property 3</property>
</child>
<property name="exprop4" datatype="integer">23</property>
</vobject>
For example, to define a blue 3D sphere, use the A3DL type for sphere, and specify properties:
<vobject name="example-sphere" type="a3dl:object3d.sphere">
<property name="a3dl:position">0 5 0</property>
<property name="a3dl:scaling">3 3 3</property>
<child name="a3dl:material" type="a3dl:material">
<property name="a3dl:color">0 0 1.0</property>
</child>
</vobject>
You can load the contents of a property from a file with the file attribute. If this is given, the contents of the XML tag are ignored. For example:
<property name="example-file" file="contents.txt"></property>
Including other VOS files
You can load other VOS files with the load tag. These files can be any supported Vobject storage format, including both XOD and COD. Create links from the current context pointing in to the other files with the fileref attribute to link. Use the linkout element to add a child link to an object from the loaded file, pointing to an object outside the file. Use the linkin element to add a child link to some object outside the file defined elsewhere, pointing to a child from the file. You can also rename objects defined in that file (e.g. to avoid name conflicts):
<load file="otherfile.xod"> <link name="link-to-otherfile-object1" fileref="otherfile-object1" /> <rename name="otherfile-object2" fileref="example5" /> <linkout fileref="otherfile-object3" name="link-to-example1" child="/example1" /> <linkin parent="/example1" name="link-into-otherfile-object3" fileref="otherfile-object3" /> </load>
To remember the difference between linkin and linkout: linkin creates a link that goes into the new file from the outer file; linkout creates a link that goes from the new file out to the outer file.
Access Control Lists
You can set up an objects ACL with the acl element, specifying identities or groups with the member tag, and use the defaultpolicy attribute to set the default for the object. defaultpolicy also works for the <property> element.
<vobject name="example8" defaultpolicy="core:read-only">
<acl policy="core:accept-all">
<member ref="/some-identity">
</acl>
</vobject>
<property name="private" defaultpolicy="property:deny-all">secret</property>
