title: Xml Serializer and Deserializer with object
body: <p>In Dot Net XmlSerializer objects to xml and Deserializer to convert xml tags to objects --
  how to do in java ?</p>
  
  <pre><code>public static object ConvertToObject(Type objectType,String strxml)
  {
    try
    {
      Object obj=null;
      XmlSerializer xs=new XmlSerializer(objectType);
      obj=xs.Deserializer(new StringReader(strxml));
      return obj;
    }
    catch(Exception e)
    {
    }
  
  //Xml serialized with ihuti java and converted to xml by argobj 
  public static object ConvertFromObject(ihutidata argobj)//ihuti.java with xml elements
  {
    try
    {
      XmlWriterSettings Sett=new XmlWritterSettings();
      settings.OmitXmlDeclaration=true;
  
      StringBuilder builder=new StringBuilder();
      XmlSerializer xs=new XmlSerializer(typeof(ihutidata));
      XmlWriter xw=XmlWriter.Create(builder,settings);
  
      xs.Serialize(xw,argobj);
      xw.close();
  
      return (builder.ToString());
    }
    catch(Exception e)
    {
      return("Exception"+e);
    }
  internal string savetodb(TSring argdata,string argclientip)
  {
    ihutidata req=(ihutidata)DataProcessing.ConvertToObject(typeof(ihutidata),argdata);
  
    if(req!=null)
    {
      ......
      ......
    }
  }
  </code></pre>
  
  <p>ya I agree with XStream it convert the xml to object and vice versa but my problem is....
  i have to call converttoobject() with class and pass it as object.
  As the program remains in C# i am doing same process in java.</p>
  
  <p>ihutidata is an class which contains xml Root elements, attributes and elements etc.
  Is it Possible in Java ? </p>