9
ActiveJDBC gets XML generation
3 Comments · Posted by Igor Polevoy in ActiveJDBC, ActiveRecord, java, Open Source, ORM
While development on this project is an ongoing effort, I do not always have time to blog about new functionality. However, XML generation is something that is really useful for REST Web services. Having this built directly into the ORM layer spares additional programming, reliance on new dependency and in general promotes the light weight style of development. I also tried to ensure that the API themselves are lightweight. Here is an example:
Person p = Person.findById(1); String xml = p.toXml(2, true);
This is simple and self – explanatory. The first parameter is a number of spaces to use for indentation, and second – whether to pre-pend the XML declaration.
Of course there is more to it than meets the eye. The LazyList also got the same method, allowing to convert a list of models into XML.
For more information, please refer to:
http://code.google.com/p/activejdbc/wiki/GenerationOfXml
Happy coding!
No tags

Evan Leonard · January 20, 2011 at 12:48 pm
Just saw this now… Looking good.
When’s the toJson() method coming?
Evan
Author comment by Igor Polevoy · January 20, 2011 at 2:54 pm
Evan, toJson() would be pretty easy to implement after the toXml(), I even have an issue for this:
http://code.google.com/p/activejdbc/issues/detail?id=14
I would probably get to it sooner, if people ask for it
thanks
Igor
mauricio.porras.p · February 20, 2011 at 12:15 pm
I agree, the toJSON() feature would be very neat