using xstream

Hi Techies,

I am sorry to post my query in this fourm. If any body has used Xstream to serialize the xml file please help me out.

I had run few xamples that are given in the net.I am getting the xml format. But I want to store this xml format in to xml file not on the console.

SportUtilityVehicle suv =new SportUtilityVehicle();

Brakes suvBrakes =new Brakes();

suvBrakes.setAllWheel(true);

suvBrakes.setBrakeType("disc");

suvBrakes.setStandard(true);

suv.setExteriorColor("White");

suv.setMaxSpeed(110);

suv.setNumberOfPassengers(8);

suv.setBrakes(suvBrakes);

XStream xstream =new XStream(new DomDriver());

//comment out the following line to turn off aliasing

//to view default serialization format

//xstream.alias("suv", SportUtilityVehicle.class);

System.out.println(xstream.toXML(suv));

Is there any feature in xStream so that we can directly write the xml content into xml file.

Generally I use XMLSerializer to write the content.

XMLSerializer serial = new XMLSerializer(stringOut,new OutputFormat("xml", "UTF-8", true));

serial.setOutputCharStream(new FileWriter(backupFileName));

My requirment is i have to create xml file and store that xml file into database.

How can i do this one?

Thanks & Regards,

Krishna

[1722 byte] By [ksrka] at [2007-10-3 11:31:51]
# 1
Please tell me you're joking. You surely can't have reached 350 posts and managed to use XMLSerializer without learning what System.out.println means!
YAT_Archivista at 2007-7-15 13:58:34 > top of Java-index,Java Essentials,New To Java...
# 2
what?
ksrka at 2007-7-15 13:58:34 > top of Java-index,Java Essentials,New To Java...
# 3
If xstream.toXml() provides a String, and System.out.println() writes that String to the console: why don't you just write it to the file instead? Just pick a different Writer.
CeciNEstPasUnProgrammeura at 2007-7-15 13:58:34 > top of Java-index,Java Essentials,New To Java...