6 Replies Latest reply: May 5, 2010 4:23 AM by 843789 RSS

    using xstream

    807599
      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