XML & Web services: Does anyone have a Visitor Design Pattern example
I have java classes that contains collection methods (like employee, company, ...) and I need to implement toXML() by transforming into an xml file. Does anyone have any example on how I can go about it. Is the Visitor pattern the right one to use. An example would help a lot or any type of help wopuld do. Thanks.
- Posted by: Web Master
- Posted on: January 04 2002 11:41 EST
Try using jaxb or castor to automate this process for you. Theres a good introductory article on javaworld this week.
I have methods that return a collection:
Date, employee, Property, List, ...
would Castor work with a collection return or do I have to make my own marshall using Visistor design pattern or something like that.
First of all i dont know anything about Visitor design pattern.
With castor - if you have an object of the class type JavaBean - castor can marshall the values in the bean to an XML file and reverse it.
Check it out here http://www.castor.org/