XStream – Package Aliasing
Xstream Package aliasing is used to create an alias of a fully qualified name of a class in XML to a new qualified name. Let us modify our example again…
Xstream Package aliasing is used to create an alias of a fully qualified name of a class in XML to a new qualified name. Let us modify our example again…
Xstream Attribute aliasing is used to serialize a member variable as an XML attribute. Let us modify our example again and add the following code to it. xstream.useAttributeFor(Student.class, "studentName"); xstream.aliasField("name",…
XStream Implicit Collections Aliasing is used when a collection is to be represented in XML without displaying the roots. For example, in our case, we need to display each note…
Xstream Field aliasing is used to create an alias of a field in XML. Let us modify our example again and add the following code to it. xstream.aliasField("studentName", Student.class, "name");…
Xstream Class aliasing is used to create an alias of a fully qualified name of a class in XML. Let us modify our original example and add the following code…
XStream supports writing JSON by initializing using XStream object with an appropriate driver. XStream currently supports JettisonMappedXmlDriver and JsonHierarchicalStreamDriver. Let us now test the code with json handling in XStream.…
XStream Object Streams provides alternative implementations of java.io.ObjectInputStream and java.io.ObjectOutputStream so that streams of objects can be serialized or deserialized from XML. This is particularly useful when large sets of…
XStream converters are the key components of the XStream library, which are responsible to convert an object to XML and vice versa. XStream provides numerous converters for common types such…
XStream supports annotations similarly like automatic configuration instead of coding. In the previous chapter, we've seen the following configurations in code. xstream.alias("student", Student.class); xstream.alias("note", Note.class); xstream.useAttributeFor(Student.class, "studentName"); xstream.aliasField("name", Student.class, "studentName");…
Xstream Aliasing is a technique to customize the generated XML or to use a particular formatted XML using XStream of Aliasing. Let’s suppose the following XML format is to be…