Discussions

General J2EE: Transforming JDO into XML data (e.g. JAXB) for presentation

  1. In my project I plan to use Session EJB and JDO (Sun's) combo on server side. I also intend to use Model 2X architecture to implement presentation layer (http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html).

    My initial thoughts were to use JAXB to represent XML data in term of Objects within my application but since JAXB is based on auto generated source code, so it is not recommended for editing purposes e.g. inserting XDoclet tags etc. [By using jdodoclet tag I thought I could enable JAXB classes as JDO classes] I am still experimenting on that.

    So far, If I used JAXB, I am forced to write a transformation layer between JAXB and JDO. Is there alternative approach to solve this problem.

    suggestions, comments, ideas are welcome !!!

    Thanks in advance,

    -Yogesh
  2. I run an open source project called Java XML View which is designed for the type of scenario you are describing. Unlike JAXB which provides XML-to-Java mapping, JXV provides Java-to-XML mapping. You start with a graph of objects (e.g. your JDO object graph) and then use JXV to produce XML for that graph.
    All the common types of Java objects are supported (JavaBeans, collections, arrays, maps, and "flat objects" like String, Integer, etc). You can also add support to your own "types" of objects if you need to.

    If you want information about the project, visit the homepage.

    Gal
  3. Thanks a lot for letting me know about JXV...looks like that is the way to go. I will explore JXV in detail.

    How about using Cocoon (2.1) on top of everything as content manager (that ofcourse it is) and as XSLT processing framework.

    -Yogesh