The XML codec can serialize and deserialize Java objects to/from XML.
XML codec support a number of annotations to the schema that control the encoding.
XML specific annotations
| Annotation | Location | Description |
xml:ns |
Schema |
Set the XML namespace of all elements. Default is none. |
xml:field |
FieldDef |
Values:
attribute = the field is encoded as an attribute in the group element.
Default for simple field types. Not applicable to group types.
element = the field is encoded as an child element in the group element.
Default for complex field types (group, sequence).
inlineElement = the field, which is a group type, is inlined within the contained group element.
This requires that there is no potential conflict with another field.
|
The following mapping between msgcodec types and XML constructs applies:
Mapping between msgcodec and XML types.
| Msgcodec | XML |
| uInt8 | xs:unsignedByte |
| uInt16 | xs:unsignedShort |
| uInt32 | xs:unsignedInt |
| uInt64 | xs:unsignedLong |
| int8 | xs:byte |
| int16 | xs:short |
| int32 | xs:int |
| int64 | xs:long |
| bigInt | xs:integer |
| decimal | xs:decimal |
| bigDecimal | xs:decimal |
| boolean | xs:boolean |
| string | xs:string |
| enum | xs:string (name) |
| time | xs:string, see TimeFormat. PENDING: use xs:time and xs:date? |
| binary | xs:base64Binary |
| sequence | XML list (tokens separated by whitespace).
String and binary values are wrapped by <i> elements.
Groups are already represented as elements. |
| group | element with group name as element name.
Fields are represented as nested attributes or elements. |