deserializing arquivo xml do xstream
Estou usando o Xstream para serializar um objeto Job. Parece estar funcionando be
mas desserializando, estou com um problema:
Exception in thread "main" com.thoughtworks.xstream.io.StreamException: : only whitespace content allowed before start tag and not . (position: START_DOCUMENT seen .... @1:1)
at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:78)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:137)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:130)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:109)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:94)
at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:48)
at com.thoughtworks.xstream.io.xml.XppDriver.createReader(XppDriver.java:44)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:845)
Algum de vocês já teve esse problema antes?
Este é o caminho que fiz para serializar:
XStream xstream = new XStream();
Writer writer = new FileWriter(new File("model.xml"));
writer.write(xstream.toXML(myModel));
writer.close();
Eu também tento isso também:
XStream xstream = new XStream();
OutputStream out = new FileOutputStream("model.xml");
xstream.toXML(myModel, out);
Para desserializar, eu fiz assim:
XStream xstream = new XStream();
xstream.fromXML("model.xml");
strutura @XML:
<projectCar.CarImpl>
<CarModel reference="../.."></CarModel>
</projectCar.CarImpl>
Se sim, eu gostaria de ouvir. Desde já, obrigado