You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Hari Lakshmanan <ha...@wakesoft.com> on 2004/01/08 19:20:42 UTC

jaxme questions

Hi,
My name is Hariharan Lakshmanan and I am in the process of enhancing our
product with JAXB framework. In this context I have following questions
1. Does JaxMe support controlling the depth of unmarshalling ? Let me
explain depth with an example 
Assume a I have Customer Object which contains Address Object and when I
want to unmarshal the XML, I wanted to unmarshal only customer and not
the contained object (meaning the depth is 1). 
 
2. Does JaxMe support unmarshalling of XML into plain java classes
(adhering to java bean spec)? If so how do I do that? The basic reason
is that I do not want to be dependent on the classes generated from
schema to do the unmarshalling Please take a look at www.jibx.org which
does this
 
 
Thank you very much
__Hari


Re: jaxme questions

Posted by Jochen Wiedmann <jo...@ispsoft.de>.
Hari Lakshmanan wrote:

> 1. Does JaxMe support controlling the depth of unmarshalling ? Let me 
> explain depth with an example
> Assume a I have Customer Object which contains Address Object and when I 
> want to unmarshal the XML, I wanted to unmarshal only customer and not 
> the contained object (meaning the depth is 1).

Such a feature is not supported. However, I do think, that it may be of
general interest to ignore certain parts of the schema while unmarshalling.

Questions:

   - Is it sufficient for you to specify the level at compile time or do
     you need to set it at runtime as well?
   - Is restriction based on a level really satisfying? I would personally
     tend to suggest that certain elements or attributes are being omitted.
     For example, like this:

         <xs:element name="Customer">
           <xs:complexType>
             <xs:sequence>
               <xs:element name="Address">
                 <xs:annotation><xs:appinfo>
                   <jaxme:details ignore="true"/>
                 </xs:annotation></xs:appinfo>
               ...

Implementing the feature would not be very difficult. It is mainly
sufficient to modify the class JAXBComplexTypeSG (the exception being
additions to the schema reader that allows to handle something like
the "ignore" attribute above), more precisely the methods

   getXMLHandlersStartElementMethod
   getXMLHandlersEndElementMethod

I would offer you detailed advice, if you'd be willing to take the
implementation on you.


> 2. Does JaxMe support unmarshalling of XML into plain java classes 
> (adhering to java bean spec)? If so how do I do that? The basic reason 
> is that I do not want to be dependent on the classes generated from 
> schema to do the unmarshalling Please take a look at www.jibx.org 
> <http://www.jibx.org> which does this

That is also not yet supported. I am about to implement a class
using Java reflection to convert a Java bean class into an instance
of XML Schema which may then be used for input to JaxMe.

In other words, this would give you the above possibility, if you
are able to inspect the bean at compile time. (Of course you'd finally
be able to do the binding at run time as well, as TomCat demonstrates
with JSP classes and the like. However, that's a task for someone else.)


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org