xstream

What are the relative advantages of XMLEncoder and XStream?

Suppose I want to store many small configuration objects in XML, and I don't care too much about the format. The XMLDecoder class built into the JDK would work, and from what I hear, XStream works in a similar way. What are the advantages to each library? ...

Deserializing a legacy XML structure in xstream

I'm trying to deserialize an xml structure that looks like this: <somecontainer> <key1>Value1</key1> <key1>Value2</key1> <key2>Value3</key2> <key2>Value4</key2> </somecontainer> I can basically choose what kind if element to deserialize to, maybe something like a List of Pair or something. The essence here is that the ...

How to ignore a type with XStream?

Hello, with XStream, how can I ignore the serialization of a defined Type (for instance, when serializing a GUI, i want to ignore all swing types)? Or if i want to ignore all javax.* types? Thanks in advance, Burkhard ...

Issue with serializing Hibernate objects using XStream

I've been facing this issue where, the hibernate objects on serialization produces unexpect xmls containing all the instrumented code from Hibernate. We did some cleaning of the object before serializing the object. But, is there a standard option available to serialize the object directly? ...

Serialise to YAML using XStream in Java

Is there a YAML driver for the Java XStream package? I'm already using XStream to serialise/deserialise both XML and JSON. I'd like to be able to do the same with YAML. ...

XStream in GWT's client side

I want to use XStream to serialize my RPC calls on my GWT application, and I'm hoping to get it done both ways, as I'm sending java objects back and forth. Is it possible to run XStream on the client side? how? Alternatively, can you recommend of any other xml-serializer for the client side? ...

externalizing junit stub objects.

Hi!    In my project we created stub files for testing junits in java(factories) itself. However, we have to externalize these stubs. After seeing a number of serializers/deserializers, we settled on using XStream to serialize and deserialize these stub objects. XStream works like a charm. Its pretty good at what it claims to be. Previ...

What is the best Java-way to create JSON/XML REST Web services that is similar to WCF?

I'm looking for a best way that is available for Java developers to implement REST services that will be communicating via JSON or XML. I'm looking for production-ready products. I know that Spring 3.0 is coming, but it's not done yet - no luck. Is Jersey the one? My application is hosted by Tomcat, uses Spring, Jettison and XStream....

How to store multiple inputs in a XML file using XStream

I want to write a program for this: in a folder I have n number of files; first read one file and perform some operation then store result in a separate XML file and the read 2nd file again perform operation and save result in same XML file, even same procedure for n number of files. The program read all files one by one and stores resul...

In XStream is there a better way to marshall/unmarshall List<Object>'s in JSON and Java

I'm using XStream and JETTISON's Stax JSON serializer to send/receive messages to/from JSON javascripts clients and Java web applications. I want to be able to create a list of objects to send to the server and be properly marshalled into Java but the format that XStream and JSON expect it in is very non-intuitive and requires our javas...

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 testing and when I run it everything seems to work fine. However when I use the call th...

how to create an InputStream from a Document or Node

How can I create an InputStream object from a XML Document or Node object to be used in xstream? I need to replace the ??? with some meaningful code. Thanks. Document doc = getDocument(); InputStream is = ???; MyObject obj = (MyObject) xstream.fromXML(is); ...

How to disable pretty-printing(white space/newline) in XStream?

This is how I create XStream instance for XML: XStream xstream = new XStream(); This is for JSON: private final XStream xstream = new XStream(new JsonHierarchicalStreamDriver() { public HierarchicalStreamWriter createWriter(Writer writer) { return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE); } })...

parse google geocode with xstream

I'm using Java and XStream to parse a google geocode request over http. My idea is to have an Address class with all the geocode attr's (ie. lat/long, city, provice/state etc) but I'm having problems parsing the xml with xstream. The google response is similar to this: <?xml version="1.0" encoding="UTF-8" ?> <kml xmlns="http://earth.g...

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 root tag (<object-stream>) but anything else would be good too. Thanks in advance. ...

XStream fromXML() exception

I am trying to deserialize a string in Java using the XStream package. The XStream package can serialize my class fine. I get the XML (cannot change format of XML) from a server and try to save its node information to the corresponding variables in a certain class. My function is at the bottom and I tried to register a new converter for ...

How do I encode UTF-8 using the XStream framework?

Per XStream's FAQ its default parser does not preserve UTF-8 document encoding, and one must provide their own encoder. How does one do this? Thanks! ...

XStream parse JSON with no root node

I am currently deserializing JSON using XStream, and it has been working great. However, when I have JSON string like the following { key1: { an_object: { something: 'foobar' } }, key2: { another_object: { data: 'hi' } } most notably it doesn't have a root node, I'm not sure how to parse it. Basically, I want the opposite of...

reading xstream generated xml into .net

We'd like to generate xml using xstream implemented with java. We'd then like to consume that xml in a .net application and have it deserialized into c# classes. has anyone had success in doing this? is there a framework available on the C# side that will make it easier and more robust than something we'd have to roll-up? ...

Serialization of Entity classes using Xstream

I'm using Xstream to serialize a EJB entity class to be transferred by a web service, but it also writes the database specific information in this case the following code. Is it possible to omit this information? <oracle.toplink.essentials.internal.helper.DatabaseField> <scale>0</scale> ...