EQUIP2 XML encoding

Chris Greenhalgh, 2006-04-07

Introduction

EQUIP2 uses Hessian as a standard (and default) binary encoding. This note describes an XML encoding which it will use by default for XML/textual renderings of object values. This format compromises self-description (e.g. explicit programming language types) for easier authoring by people and non-Java/EQUIP applications. This does however imply that the some knowledge of the programming language types must be known and/or a scripting framework with consistent coercions to/from strings be used.

Example

A representative example of a class encoded in the proposed encoding follows (from the Day of the Figurines 2 development work-in-progress):
<?xml version="1.0"?> 
<objects defaultPackage="dof2.db" [optional] >
<Player [ie class name without package] package="dof2.db" [optional]>
<ID [ie property name]>P1_nick</ID>
<nickName>nick</nickName>
<currentMissions [e.g. a set or list]>
<set [or array or vector]
size="2" [may be required for arrays; definitely optional for sets]
elementjavatype="java.lang.String" [optional; required for array of primitives] >
<item [i.e. a repeatable 'property' of the set/array]
javatype="java.lang.String" [optional; defaults to string (coercion deals with most cases)]
>M1_thing</item>
<item>M2_thing</item>
</set>
</currentMissions>
<fullName [NB value is the empty string, not null] />
<someMapProperty>
<map [i.e. hashtable]>
<item>
<entry [i.e the entry itself] >
<key javatype="java.lang.String" [optional; see above] >123</key>
<value javatype="java.lang.String" [optional; see above] >456</value>
</entry>
</item>
</map>
</someMapProperty>
<someComplexProperty>
<Person [another person...] >
<!-- the usual XML comment(s) -->
</Person>
</someComplexProperty>
</Player>
</objects>

Additional notes:

Note: I think that this should work in J2ME aswell.

See sample program to read such a file: equip2.core.test.j2se.XmlReader

Known issues

Change log

2006-04-18
2006-04-07