Discussions

XML & Web services: Does anyone have a Visitor Design Pattern example

  1. Does anyone have a Visitor Design Pattern example (3 messages)

    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.

  2. Try using jaxb or castor to automate this process for you. Theres a good introductory article on javaworld this week.

    Javaworld article

    Stuart
  3. 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.

    Need help?
  4. 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/