Steve,
can you please create a new Jira ticket at
http://jira.codehaus.org/browse/CASTOR, and attach a fully working
(JUnit preferably) test case that allows us to reproduce the problem.
Thanks
Werner
Steve Kingsland wrote:
> Sorry to dig up an old thread, but I think I'm having the same issue
> as NMcLoughlin
> was. My case is pretty simple though: when I marshall a Java5 enum, it
> works, but I get extra namespace details added to the XML Element that I
> don't want. I'm using Castor 1.3.
>
> My POJO contains a simple Java5 enum:
>
> public enum MyEnum {Yes, No}
>
> public MyEnum yesNo;
>
> My mapping maps the Java property to an XML Element:
>
> <field name="yesNo">
> <bind-xml name="myElement">
> </field>
>
> And when I marshall to XML, I'd expect to see this, right?
>
> <myElement>Yes</myElement>
>
> But what I'm getting is this:
>
> <myElement *xmlns:java="http://java.sun.com" xsi:type="java:java.lang.**
> String"*>Yes</myElement>
>
> Can anyone explain why that is?
>
> I haven't tried *unmarshalling*, because for the current project I'm working
> on, I only need to marshall.
>
> -Steve
>
> On Wed, Dec 17, 2008 at 4:52 PM, <[email protected]> wrote:
>
>> Sorry I should have been more clear. That is where the problem is. Object
>> --> xml. I don't have a call for the other way, but can set one up.
>>
>>
>>
>>
>> Werner Guttmann
>> <werner.guttmann@
>> gmx.net> To
>> [email protected]
>> 12/17/2008 03:39 cc
>> PM
>> Subject
>> Re: [castor-user] Java 5 Enums and
>> Please respond to xsi:type
>> [email protected]
>> aus.org
>>
>>
>>
>>
>>
>>
>>
>>
>> Hi,
>>
>> before looking into this, can I ask you to marshal some Object instance
>> to XML to make sure whether that side of things work.
>>
>> Regards
>> Werner Guttmann
>>
>> [email protected] wrote:
>>> Yes, I'm using a mapping based approach. Just a simple enum:
>>>
>>> public enum Type {
>>>
>>> ABC, VDR, ICZ;
>>>
>>> }
>>>
>>> And here's the relevant part of my mapping:
>>>
>>> <field name="type" type="com.mycompany.Type">
>>> <bind-xml name="cv:type" node="element"
>>> xmlns:cv="http://www.mycompany.com/Type" />
>>> </field>
>>>
>>> Thanks for your help.
>>>
>>>
>>>
>>>
>>> Werner Guttmann
>>> <werner.guttmann@
>>> gmx.net>
>> To
>>> [email protected]
>>> 12/17/2008 03:15
>> cc
>>> PM
>> Subject
>>> Re: [castor-user] Java 5 Enums and
>>> Please respond to xsi:type
>>> [email protected]
>>> aus.org
>>>
>>>
>>>
>>> Hi,
>>>
>>> yes, this could be an issue, as it all depends how you've developed your
>>> enum to which this XML should be mapped (assuming that you are using a
>>> mapping-based approach).
>>>
>>> How does your enum look like ?
>>>
>>> Regards
>>> Werner
>>>
>>> [email protected] wrote:
>>>
>>> I'm having an issue with marshalling java 5 enums.
>>>
>>> The generated xml has the following declaration:
>>> xsi:type="java:java.lang.String", as in:
>>>
>>> <cv:type xsi:type="java:java.lang.String"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:c="http://www.mycompany.com/Type">ABC</cv:type>
>>>
>>> ... which obviously doesn't validate. How can this be prevented?
>>>
>>> I've seen this issue posted several times against previous versions of
>>> Castor but with no solutions. I'm using Castor version 1.3rc1. Is this
>>> still an issue?
>>>
>>> Thanks.
>>
>> -----------------------------------------
>> CONFIDENTIALITY STATEMENT:
>> This e-mail transmission contains information that is intended to
>> be confidential. It is intended only for the addressee named
>> above. If you receive this e-mail in error, please do not read,
>> copy, or disseminate it. If you are not the intended recipient,
>> any disclosure, copying, distribution or use of the contents of
>> this information is prohibited. Please reply to the message
>> immediately by informing the sender that the message was
>> misdirected. After replying, please erase it from your computer
>> system. Your assistance in correcting this error is appreciated.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email