Bryan,
I checked in a simple fix for this issue into CVS...so if you can use
the CVS version, then you don't have to do the unmarshalling manually.
--Keith
Bryan Helm wrote:
>
> Well, I can just unmarshall it myself if I have to. I
> am glad that marshalling works, as it allows me to
> treat output uniformly. I already have to know what
> to expect on the unmarshalling side, since the
> unmarshaller wants to know the class to unmarshall to,
> so I can just handle the boolean expected case without
> using an unmarshaller. I was just surprised that
> marshalling and unmarshalling are not inverse
> operations - I expected that what could be marshalled
> by Castor should be able to be unmarshalled by Castor.
> No big deal, I just will be careful not to make that
> assumption anymore. Thanks for your prompt reply.
>
> Bryan
>
> --- Keith Visco <[EMAIL PROTECTED]> wrote:
> >
> >
> > There is built-in support for the primitive types,
> > but not as the root
> > element.
> >
> > Try putting your Boolean inside another object as
> > such:
> >
> > public class MyRoot {
> >
> > private Boolean value = null;
> >
> > public MyRoot() {
> > }
> >
> > public void setValue(Boolean value) {
> > this.value = value;
> > }
> >
> > public Boolean getValue() {
> > return value;
> > }
> > }
> >
> > --Keith
> >
> > Bryan Helm wrote:
> > >
> > > I am trying to marshall/unmarshall a simple
> > Boolean
> > > value that is not nested in a class. Marshalling
> > > works fine.
> > > StringWriter sw = new StringWriter();
> > > Marshaller.marshal(new Boolean(true),sw);
> > > System.out.println(sw.toString());
> > > will print out:
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <boolean>true</boolean>
> > > I expected unmarshalling to be just as easy, so I
> > > expected this to work:
> > > Boolean val =
> > (Boolean)Unmarshaller.unmarshal(
> > > Boolean.class,
> > > new StringReader(sw.toString()));
> > > but instead I get the exception:
> > > unable to create XMLClassDescriptor for class:
> > > java.lang.Boolean
> > > I understand that Boolean does not follow the bean
> > > conventions (no getter/setter for the value), but
> > I
> > > thought there was built-in support for primitives
> > and
> > > wrappers (as there appears to be on the
> > marshalling
> > > side). I was surprised that something could be
> > easily
> > > marshalled that could not be just as easily
> > > unmarshalled. Any clues for me?
> > >
> > > I am using version 0.9.4.3.
> > >
> > > Bryan
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > The New Yahoo! Shopping - with improved product
> > search
> > > http://shopping.yahoo.com
> > >
> > >
> >
> -----------------------------------------------------------
> > > If you wish to unsubscribe from this mailing, send
> > mail to
> > > [EMAIL PROTECTED] with a subject of:
> > > unsubscribe castor-dev
> >
> >
> -----------------------------------------------------------
> >
> > If you wish to unsubscribe from this mailing, send
> > mail to
> > [EMAIL PROTECTED] with a subject of:
> > unsubscribe castor-dev
> >
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev