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