javax.xml state serialization.
The XML representations consumed and produced by this service are, by default, verbose, and safe to deserialize.
This is because the default mapping is purely structural.
You can customize the XML representations using
JavaxXmlSettings
and
JavaxXmlAdapters
.
The following describe how state is represented by default.
Because a valid XML document can only contain a single node and it must be an element, all
Document
s have a root element <state/>. This serialization implementation
also impose that the root element can only contain a single node, of any type.
null is represented as <null/>.
Plain values are represented as
Text
nodes.
Iterables and Streams are represented as <collection/>
Element
s.
Maps are represented as <dictionary/>
Element
s.
This is how a null plain value is represented: <state><null/></state>.
And a plain LocalDate: <state>2017-01-01</state>
This is how a fictional value including a collection and a map is represented:
<state>
<stringProperty>and it's value</stringProperty>
<bigDecimalProperty>4.22376931348623157E+310</bigDecimalProperty>
<nullProperty><null/></nullProperty>
<booleanProperty>false</booleanProperty>
<stringCollectionProperty>
<collection>
item1
item2 <!-- As multiple text nodes -->
</collection>
</stringCollectionProperty>
<mapProperty>
<map>
<foo>bar</foo>
<bazar>cathedral</bazar>
</map>
</mapProperty>
<complexKeyMapProperty>
<map>
<entry>
<key>
<foo>bar</foo>
<bazar>cathedral</bazar>
</key>
<value>23</value>
</entry>
<entry>
<key>
<foo>baz</foo>
<bazar>bar</bazar>
</key>
<value>42</value>
</entry>
</map>
</complexKeyMapProperty>
</state>