users@jaxb.java.net

Re: Applicability of JAXB

From: Vishy Kasar <vkasar_at_borland.com>
Date: Thu, 23 Jan 2003 11:57:28 -0800

Nick,

I am pretty much in the same boat as you. New to JAXB and trying to figure out if it is suitable for our application which uses a proprietary XML to Java binding right now.

Few things that may stop the use of JAXB in our app:

1. Not supporting abstract type and not providing an escape hatch for such cases not currently supported by JAXB.
2. Inability to provide a class to be the parent of the generated impl class. If this is possible and I missed it, can some
JAXB expert let me know?

Compared to DOM, Be also aware that generated code tends to be more bloated than you may imagine.
Based on the following XML

    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>

Many times, you just want
interface ServletMapping {
  String getServletName();
  ...
}

However what you get may be much different based on how schema defines each type. You will not have such problems when you are dealing directly with DOM. You get what you see in XML.

BTW, on the #2 on your list: JAXB spec allows specification of bindings in a separate XML. It is just that JAXB RI at this point does not support that feature.
  ----- Original Message -----
  From: Nick Duan
  To: JAXB-INTEREST_at_JAVA.SUN.COM
  Sent: Thursday, January 23, 2003 11:18 AM
  Subject: Applicability of JAXB


  After reading the spec and playing with the samples, I have some thoughts I'd like to share and get some feedbacks from the experts. I'm new to the group, so please forgive or ignore if you find my comments out of focus.

  1. One of the goals of JAXB (as defined in the spec) is to circumvent SAX/DOM by allowing applications to access XML data directly via Java objects. But the new Java APIs generated by xjc still have to be incorporated into your application. I'm not sure if the effort is going to be less than using SAX/DOM's API since most people are familiar with the standard. If you design an application from scratch, your application will be bound to the schema and JAXB APIs. So if the schema changes, you have to modify and recompile your application, whereas it wouldn't always be the case if using SAX/DOM.

  2. Customization could be a very useful feature of JAXB. But why the binding declarations have to be defined within an XML schema itself? Suppose I have one schema to be customized for different applications, so I have to define multiple schema files, each with a different binding declaration. Usually XML schemas are defined and administrated in a central repository on the web, creating your own schema everytime you want to customize the binding seems to be quite awkward. I think it will make JAXB more extensible if binding declarations are externalized from the schema itself, similarly as XSLT definitions for an XML doc.

  3. Apparently JAXB still uses SAX/DOM underneath when marshalling/unmarshalling an XML doc. Conceptually, you should be able to do the marshalling/unmarshalling without building the DOM tree, at least for performance reasons. Any thought or future plans regarding this?

  4. Has anyone done any comparison studies on JAXB with other similar products? Castor, JBind, etc..

  5. Does anyone acutually use or consider using JAXB for applications? I'd really appreciate if you could provide some insider thoughts.

  Thanks a lot!

  ND