Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

XMLSerializer

 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In .NET, there's an XMLSerializer class which serializes objects into XML. Is there an equivalent to this in Java? I tried looking in the API documentation, but there doesn't seem to be any.
Any guidance would be greatly appreciated. Thanks.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In SDK 1.4 API look at java.beans.XMLEncoder and XMLDecoder - and that just for a start. There are a number of projects related to moving between Java objects and XML representation. Try a search for "Java XML serialization" at google - I just got "about 48,000" hits.
Bill
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sir,
Thank you for replying. I tried out the XMLEncoder class, but it seems to work only with Java beans. If for instance, I wanted to serialize my own class into XML such as:
public class TestClass
{
public String x1 = "this is variable x1";
public int y = 999;
}
How would I do that? There's no built-in XMLSerializer in Java, is there? As you said, there are a lot of projects out there. Could you recommend some free ones to help me get started? Thanks.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use JSX, it is opensource and excellent!!! But do remember, if you distribute it, you will need either pay or make your product GPL licensed.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the info! Hmm... are there any truly free ones out there?
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stanley Tan:
Thanks for the info! Hmm... are there any truly free ones out there?


hmmm... If your product is a truly free one, then JSX definitely is a truly free one too.
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stanley Tan:
Thanks for the info! Hmm... are there any truly free ones out there?


Check
http://castor.exolab.org/
and
http://jbind.sourceforge.net/jBind.html
 
It means our mission is in jeapordy! Quick, read this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic