Questions tagged [xstream]

XStream is a simple Java library to serialize objects to XML and back again.

XStream

XStream is a simple library to serialize objects to XML and back again. It is typical used for Transport, Persistence, Configuration and Unit Tests.

Features

  • Ease of use. A high level facade is supplied that simplifies common use cases.

  • No mappings required. Most objects can be serialized without need for specifying mappings.

  • Performance. Speed and low memory footprint are a crucial part of the design, making it suitable for large object graphs or systems with high message throughput.

  • Clean XML. No information is duplicated that can be obtained via reflection. This results in XML that is easier to read for humans and more compact than native Java serialization.

  • Requires no modifications to objects. Serializes internal fields, including private and final. Supports non-public and inner classes. Classes are not required to have default constructor.

  • Full object graph support. Duplicate references encountered in the object-model will be maintained. Supports circular references.

  • Integrates with other XML APIs. By implementing an interface, XStream can serialize directly to/from any tree structure (not just XML).

  • Customizable conversion strategies. Strategies can be registered allowing customization of how particular types are represented as XML.

  • Error messages. When an exception occurs due to malformed XML, detailed diagnostics are provided to help isolate and fix the problem.

  • Alternative output format. The modular design allows other output formats. XStream ships currently with JSON support and morphing.

References

1024 questions
8
votes
2 answers

Is there a way to put a version number in XML generated by XStream?

I serialize my domainObjects using XStream. I would like to add some kind of versioning information to a generated xml file just in case my domain model changes. Is there a way to do it using xstream ? I vould prefer a parameter named "version" in a…
Łukasz Bownik
  • 6,149
  • 12
  • 42
  • 60
8
votes
1 answer

xstream - reusing the default converter in a custom converter

I'm using xstream to process an xml string but some fields of the object have changed between versions, so i'm implementing a custom converter. A summary of the field changes is listed below, and only the first two field types are different. Field …
emeraldjava
  • 10,894
  • 26
  • 97
  • 170
8
votes
4 answers

Spring RestTemplate and XMLStream use with List of Objects

I am trying to use Spring RestTemplate to retrieve a List of Employee records, such as: public List getEmployeesByFirstName(String firstName) { return restTemplate.getForObject(employeeServiceUrl + "/firstname/{firstName}", List.class,…
alvinegro
  • 81
  • 1
  • 1
  • 3
8
votes
3 answers

xStream problems - How to deserialize multiple objects

I'm using xStream to manipulate XML. All is okay. To put on XML archive and other things. But, I have a problem: Example: My xml contains a tag , and inside this one, I have some more tags named . Look at a example code:
Andrey Luiz
  • 461
  • 9
  • 25
8
votes
3 answers

Vulnerability warning with XStreamMarshaller

When using a XStreamMarshaller with spring batch, I get the following message: Security framework of XStream not initialized, XStream is probably vulnerable. First try: According to the documentation, I've tried to reset all permissions, but I…
Nicolas
  • 1,812
  • 3
  • 19
  • 43
8
votes
1 answer

Can't add XStream file dependency to Android Studio project

I have downloaded and added xstream-1.4.8.jar to my Android Studio project. When I build the project it works fine but when I try to run it I get the following error from the Gradle Build window: Information:Gradle tasks…
Sam
  • 105
  • 1
  • 6
8
votes
4 answers

XStream parse attributes and values at the same time

I have the following XML Buenos Aires, Argentina Buenos Aires, Brazil Aeroparque Buenos Aires, Argentina
gurbieta
  • 866
  • 1
  • 8
  • 22
8
votes
2 answers

Using Transient Entity in Hibernate to Update/Merge an existing Persistent Object

I am dealing with a fairly complex object graph in my database. I am using XStream to serialize and deserialize this object graph which works fine. When I import an object graph of an object that exists in the database, it is initially transient,…
eipark
  • 7,442
  • 3
  • 24
  • 33
8
votes
2 answers

Xstream driver performance

I am using XStream to convert XML to objects. I am converting large xml. I have encountered below two statements. XStream xstream = new XStream(new DomDriver()); XStream xstream = new XStream(new StaxDriver()); Since I am using large xml for…
Java P
  • 2,241
  • 6
  • 31
  • 45
7
votes
1 answer

XStream double underline handling (Java)

I wanted to serialize a java class to XML with XStream. I needed to generated an XML element with one underline (canal_operateur), but XStream adds a second underline in the xml element name. So how to keep only one underline ? With the default…
codeisee
  • 1,612
  • 2
  • 11
  • 9
7
votes
4 answers

Under Tomcat java.lang.NoClassDefFoundError when accessing a servlet?

I'm writing a web applicaion in Eclipse, and I'm using the XStream Serialization Library to generate My JSON. I've encapsulated the Code that builds up the JSON in a class which is called by my servelet. Then encapsulated class has a main method for…
Omar Kooheji
  • 54,530
  • 68
  • 182
  • 238
7
votes
1 answer

Find if a node exists in XStream api

I have an XML structure similar to following. I have converters to write each object A, B, and C. Is it possible in XStream to check if the a node exists in the XML hierarchy? i.e in the case below, I want to do something if B node exists before I…
somename
  • 978
  • 11
  • 30
7
votes
0 answers

XStream Illegal reflective access Problem after upgraded to java 10

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:libraries/xstream-1.4.10.jar) to field java.util.TreeMap.comparator
Sreejith S S
  • 109
  • 2
  • 7
7
votes
2 answers

Drools XStream in a spring service

I'm starting to work with drools , I wanted to use it in spring-boot service, but even for a simple example I 've got a no such method error on Xstream. What did I miss? Caused by: java.lang.NoSuchMethodError:…
Goofyrocks
  • 153
  • 1
  • 9
7
votes
3 answers

How can I disable unnecessary escaping in XStream?

XStream by default unnecessarily escapes >," ... etc. Is there a way to disable this (and only escape <, &)?
mike g
  • 1,791
  • 1
  • 18
  • 25
1 2
3
68 69