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 ... |
I am using nice little piece of xstream to perform serialization.
I have the following class :
// version 0
class A {
}
// version 1
class A {
Object o = new ...
|
I need to decide on which one to use. My case is pretty simple. I need to convert a simple POJO/Bean to XML, and then back. Nothing special.
One thing I ... |
We have an XML that needs to be converted to an object and vice versa. Something like Xstream does. Until now we were using Xstream to marshall and unmarshall the object/xml. ... |
I have
class A {
@xstreamalias("obj1");
Object obj1;
@xstreamalias("obj2");
Object obj2;
}
and I want to change to
class AbstractA {
@xstreamalias("obj1");
... |
I have a little problem with a class I am currently writing a save function for.
I'm using XStream (com.thoughtworks.xstream) to serialize a class to XML using the DOMDriver.
The class looks like ... |
XStream by default unnecessarily escapes >," ... etc.
Is there a way to disable this (and only escape <, &)?
|
|
I encountered an incompatibility with xstream and IBM J9 jdk (the 32bits version). Everything worked fine when I used sun jdk but fails on IBM jdk (on linux only. on windows ... |
I have the following code :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package helloworld;
import com.thoughtworks.xstream.XStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.swing.JOptionPane;
/**
...
|
I'm trying to track down th source of a warning:
warning: Cannot find annotation method 'itemFieldName()' in type 'com.thoughtworks.xstream.annotations.XStreamImplicit'
The relevant code is:
@XStreamAlias("things")
@XStreamImplicit(itemFieldName = "things")
private List<Thing> things;
Looking at the XStream JAR I see:
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
@java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD})
public ...
|
I'm thinking of using the XStream library but I have a couple of questions/concerns.
Say I have a complex object that I want to serialize into XML (or JSON) using XStream. ... |
I am looking to build java objects
<placement_rules>
<section name="news">
<front_order>
<article_type name="article1"></article_type>
<article_type name="article2"></article_type>
...
|
I felt xstream loading speed doesn't up to my requirement when I try to perform loading from the XML file. For
an "database" with 10k ++ entries, it will take several minutes.
The ... |
Previously, to read XML in UTF-8 encoding through xstream, I am using DomDriver as follow :
XStream xStream = new XStream(new DomDriver("UTF-8"));
However, later I realize this is VERY slow. I use the ... |
I have class:
public class EnglishWord implements Serializable, Comparable,
Cloneable {
static Logger logger = Logger.getLogger(EnglishWord.class);
private static final long serialVersionUID = -5832989302176618764L;
private ...
|
I have two java classes....
public class Item {
private int itemIndex;
private String containerType;
private Map<String, List<String>> contentType;
private ...
|
I have the following class:
import org.apache.commons.beanutils.BeanUtils;
import com.thoughtworks.xstream.XStream;
...
public class MyBean {
protected static final XStream XSTREAM = new XStream(new DomDriver());
protected String name;
...
|
I had the following class.
class SimpleDate {
private final int year; /* ? */
private final int month; /* 0 ~ 11 ...
|
I'm using XStream to load a file structured like this:
<parent>
<child/>
<child/>
</parent>
Into a class like this:
public class Parent(){
private List<Child> children;
}
public class Child {
private Parent parent;
}
I ... |
I have a java class that looks like
public class MyClass {
private final String str;
private Polygon polygon; // this polygon is a custom type of mine
}
I ... |
I'm working with XStream but I have a problem with the special characters á,é,í,ó,ú and ñ.
I tried this:
String charset = "UTF-8";
xstream = new XStream(new DomDriver(charset));
(don't work)
I found ... |
I have encountered a problem.
I have a XML, that's wasn't made by me.
This XML has in a part of the code a follow structure:
<activities>
<activity>
<id>1</id>
...
|
Is there a way to prevent XStream from displaying something like follows:
<user class="string">user</user>
<password class="string">password</password>
in an xml output?
|
I'm trying to load an XML file of the following format:
<?xml version="1.0" encoding="ISO-8859-1"?>
<MyCompany>
<Record>
<Surname>
...
|
I've been using xstream in to serialize an object with name and description (and other fields).
class MyClass {
String name;
String description;
....
...
|
I'm doing a test program to write in a xml.
I have 3 classes: Person, Telephone and City.
And in the Person class, I have some objects like fax, cellular of type telephone.
And ... |
Can I safely use XStream to process XML coming from outside of my system ?
What's the best practice when dealing with "potentially malicious XML" using xstream ?
Let's say, I have a ... |
I have got the XStream package by apt-get install libxstream-java. I'd like to use the XStream class in my java program, so I try to include the XStream class by importing ... |
I have the following XML:
<patient>
<name>Mr. Sick</name>
<report>
<paragraph><bold>Conclusion</bold>text...</paragraph>
</report>
</patient>
I would like to convert this ... |
I'm using xstrem to serialise a jodatime local date into xml.
However when output the generated xml the LocalDate is not in an easily readable format.
See below:
<date>
<iLocalMillis>1316563200000</iLocalMillis>
...
|
I have some XML files stored by XStream a while ago, and they include references to RandomAccessSubList, a class which is not visible beyond the package level and has no default ... |
I have a class of user with the following attributes:
/** The username. */
private String username;
/** The password. */
private String password;
/** The list of role names the user has. */
private List<String> roleNames;
/** ...
|
I am learning XStream.Net library.
Since I have not found some good tutorials for XStream.Net, I go through Java XStream one on the page: http://xstream.codehaus.org/alias-tutorial.html
I have ... |
|
|
Replace \n with \\n before printing it to the web page. Line breaks will show up as \n literals, which are then treated as line breaks by JavaScript. Or you can replace \n with the empty string stripping out all enters completely. On a side note, your approach is still a bit dangerous - if your XML document contains any quotes ... |
|
|
|
|
|
OK, My questions are: [1]. what I generated XML by XSTream is very complicated, especially for object LocationTest, Can we make it as simple as others such as Person object?? [2]. after I run it, LocationTest will popup and a red ball in a panel will dsiplay, after I change red ball's position, I hope to persist it to xml, then ... |
I don't think I can help since I don't don't understand. You seem to be saying that you have some XML that is passed though xstream not generated by xstream. Do you mean that the XML comes from the client and represents some object state and that changing the xstream version has changed the way the object state is represented? If ... |