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
0
votes
2 answers

XStream fail on trivial xml

I have very simple xml file: testSimple2.txt But for some reason I can't deserialize it with XStream. Root.java @XStreamAlias("root") public class Root { @XStreamAlias("document") static public class…
kolobok
  • 3,835
  • 3
  • 38
  • 54
0
votes
1 answer

Xstream nested Array Issue

I have XML structure as below and My class structure is as below Class PaymentData …
0
votes
1 answer

XStream - treat objects with the same identifier as one

I am working on a legacy system where XStream is being used to serialize objects in order to keep two databases in sync. A new object is first stored in one database, then the stored object is serialized and sent to be stored in the other…
Tobb
  • 11,850
  • 6
  • 52
  • 77
0
votes
2 answers

Parsing nested tags with XStream

I'm using a database API called Socrata to parse information for recycling services. An example of the XML output from this service can be found here: http://www.datakc.org/api/views/zqwi-c5q3/rows.xml?search=%22computer%22 As you can probably tell,…
Blake Beaupain
  • 638
  • 1
  • 6
  • 16
0
votes
1 answer

XStream: Deserialisation of a serialised java.sql.Time causes error

The following code throws an exception, which I didn't expect at all! long now = System.currentTimeMillis(); java.sql.Time t1 = new java.sql.Time(now); String s1 = new XStream().toXML(t1); java.sql.Time t2 =…
Ant Kutschera
  • 6,257
  • 4
  • 29
  • 40
0
votes
1 answer

Deserializing a XML to Object with xstream when an attribute is generic

I'm receiving the following XML from a client: someAction // actionX, actionY, and so forth... Some name 1234567890 . . . etc... …
Satella
  • 1
  • 1
  • 2
0
votes
0 answers

Is it possible to marshall object tree to source code?

Is it possible to marshall java objects tree to source code, that generates the tree? What I am trying to do is to create sample data for integration testing from live data. I need to serialize sample objects (i.e. JPA entities) to a human readable…
Piotr Gwiazda
  • 12,080
  • 13
  • 60
  • 91
0
votes
1 answer

parse XML to POJO using XStream

I have an xml file which I want to read and parse it into POJO. I am using XStream for this. I am not able to send the file as an input to the code for parsing(file is on my local drive). How to read the xml file and parse it using fromXML() method…
shiny
  • 43
  • 1
  • 11
0
votes
2 answers

self close tag issue xstream when null

I have an class like below and I use xSteam to convert Edge to xml. @XStreamAlias("edge") class Edge{ @XStreamAsAttribute @XStreamAlias("source") private String source; @XStreamAsAttribute @XStreamAlias("target") …
Steven
  • 3
  • 2
0
votes
1 answer

How to convert different child XML elements from an XML node into a generic java type instances using XStream?

From my simple XML below, I want to create an instance of SomeApplication with a collection of Field instances where each Field instance to represent a child element of . The Field instances would have two String properties, name…
ssethupathi
  • 363
  • 1
  • 3
  • 11
0
votes
1 answer

XStream converting issue (different subclasses in the same list)

I am only interested in de-serialization. I have some data that looks like this:
Whimusical
  • 6,401
  • 11
  • 62
  • 105
0
votes
1 answer

Xstream: getting rid of Collection implementations in resulting xml

What's the easiest way to get rid of this stuff with Xstream:
auramo
  • 13,167
  • 13
  • 66
  • 88
0
votes
2 answers

OutOfMemory when parsing String XML to Java Objects

Problem - Memory Utilization keeps growing in my program when parsing an XML string. I have an XML stream coming in live on a TCP port. I use Netty to pull the xml data out and then I use XStream to deserialize/unmarshal the XML String into Java…
FatherFigure
  • 1,135
  • 1
  • 16
  • 39
0
votes
1 answer

how to xstream to xml serialization of java object?

I have a java application and it produces xml output like: I have tried many things but no luck yet.…
Mehedi
  • 159
  • 3
  • 4
  • 10
0
votes
1 answer

Importing XStream jar(s)

I'm working on a project in java that's supposed to let the user type in a bunch of data. The data typed in is then going to be handled by the program so that it can be graphically shown to the user. Once the data is typed in I want there to be a…