XStream – Custom Converter for BufferedImage

In the previous tutorials we saw an example of how to convert a java object to XML and back. That tutorial also explained the concept of aliases and implicit collection. While serializing a Java object to XML XStream uses custom converters. These converters specify how to create XML from a Java Object or how to … Read more

XStream – Referencing Objects

XStream allows you to store references while converting a java object to XML. Consider a case where you have an Artist Object. The object contains albums that the artist has released, but you also want to store a reference to a ‘similar artist’. People listening to an artist might be interested in listening to a … Read more

XStream – Handling Attributes in XML

In the previous tutorial we saw how to convert Java to XML and back. In this tutorial we look at different ways to handle XML attributes using XStream. However note that the attributes are only safe if you know that the written String values are not affected by the XML parser’s white space normalization. The … Read more

XStream – Java to XML Using Annotation

Convert Java to XML using annotation In the previous tutorials we saw an example of how to create a java object from XML. That tutorial also explained the concept of aliases and implicit collection. In this tutorial we continue with that but use annotation on the java class. The advantage with annotation is that it … Read more

XStream – Java to XML

The Problem Statement In the previous example we saw how to convert a Java Object to XML and back. In this example we look at another example of Java Object to XML Conversion. The example uses an object called a ‘JazzArtist’. This object has a list of ‘Album’ objects besides some other properties. We see … Read more

XStream – XML To Java

In the earlier tutorial we looked at a way to convertJava to XML and back. In this tutorial we look at some more examples of XML To Java Conversion. XStream can convert XML elements to multiple types depending on the type specified in the Java class. For example a series for similarly named elements can … Read more

XStream – Java to XML and Back

The Problem Statement XStream can be used to convert a Java Object to XML and back. This tutorial aims to create a java representation of the BBC RSS. We will start with a Simple java class and gradually start adding complexity to it so that it can be converted to the BBC RSS. Note that … Read more

Xstream – Introduction

What is XStream XStream is a java library to convert Java Object into XML and back. You can take nearly every arbitrary deeply nested object turn it to XML and read it back without further configuration. You’re done if all you want to have is a persisted object in XML. XStream’s power lies in its … Read more