随笔分类 -  Simple-xml-serialization

all
摘要:This page provides a tutorial that will prepare users for using XML serialization. Before this tutorial is attempted it is advisable to have a look at the Javadoc documentation for the framework. Alt... 阅读全文

posted @ 2009-05-14 16:35 吕布

12.Java Bean serialization
摘要:Although field based serialization offers a simple and efficient means for serializing and deserializing an object it can often be benificial to use Java Bean getters and setters to read and write val... 阅读全文

posted @ 2009-04-01 21:03 吕布

11.Loose object mapping
摘要:An important feature for any XML tool is the ability to sift through the source XML to find particular XML attributes an elements of interest. It would not be very convinient if you had to write an ob... 阅读全文

posted @ 2009-04-01 20:38 吕布

10.Scattering inline element entries
摘要:Elements that are scattered throughout an XML document can be collected by inline lists and inline maps. Simply provide an entry name for the XML element name the list or map is to collect and they wi... 阅读全文

posted @ 2009-04-01 20:13 吕布

9.Dealing with map objects
摘要:Although it is possible to deal with most repetitive XML elements within documents using element lists it is often more convenient to use a Map object. In order to deal with maps the ElementMap annota... 阅读全文

posted @ 2009-04-01 19:47 吕布

8.Adding text and attributes to elements
摘要:As can be seen from the previous example annotating a primitive such as a String with the Element annotation will result in text been added to a names XML element. However it is also possible to add t... 阅读全文

posted @ 2009-04-01 19:23 吕布

7.Reading an array of elements
摘要:As well as being able to deserialize elements in to a collection arrays can also be serialized and deserialized. However, unlike the @ElementList annotation the ElementArray annotation can also deseri... 阅读全文

posted @ 2009-04-01 19:00 吕布

6.Dealing with an inline list of elements
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> example first value second value third value ... 阅读全文

posted @ 2009-04-01 17:07 吕布

5.Reading a list of elements
摘要:In XML configuration and in Java objects there is often a one to many relationship from a parent to a child object. In order to support this common relationship an ElementList annotation has been pro... 阅读全文

posted @ 2009-04-01 16:17 吕布

4.Optional elements and attributes
摘要:At times it may be required to have an optional XML element or attribute as the source XML may not contain the attribute or element. Also, it may be that an object field is null and so cannot be seria... 阅读全文

posted @ 2009-04-01 14:23 吕布

2.Deserializing a simple object
摘要:Taking the above example object the XML deserialization process is described in the code snippet shown below. As can be seen the deserialization process is just as simple. The persister is given the ... 阅读全文

posted @ 2009-04-01 13:09 吕布

1.Serializing a simple object
摘要:In order to serialize an object to XML a series of annotations must be placed within that object. These annotations tell the persister how the object should be serialized. For example take the class s... 阅读全文

posted @ 2009-04-01 12:54 吕布

导航