Hi,

you still need to instruct the Unmarshaller to use the mapping file, by
calling

unmar.setMapping(mapping):

Regards
Werner

bin lin wrote:
> Werner,
> 
> Here is the snippet code that I used for mapping:
> 
>   
>   File mappingFile =
> RMConfigConstants.getFile(RMConfigConstants.POLICY_STORE_MAPPING_FILE_NAME);
>   Mapping mapping = new Mapping();
>   mapping.loadMapping(mappingFile.toURL());
>   Unmarshaller unmar = new Unmarshaller(mapping);
>   m_policyStore = (RMPolicyStore)
> unmar.unmarshal(RMPolicyStore.class, reader);
> 
> 
> I also tried :
> 
>  m_policyStore = (RMPolicyStore)
> Unmarshaller.unmarshal(RMPolicyStore.class, reader);
> 
> However I couldn't see any different between them 
> 
> 
> --- Werner Guttmann <[EMAIL PROTECTED]> wrote:
> 
>> Bin,
>>
>> How are you invoking the Marshaller/Unmarshaller to
>> (un-)marshall your entities ? If you are using the
>> static (un-)marshal methods, the mapping file
>> provided by you will not be considered during the
>> (un-)marshalling operation. If you still want your
>> mapping file to be applied, please consider using
>> the non-static (un-)marshal methods.
>>
>> You might find it worthwhile to have a look at the
>> F.A.Q. to be found at
>> http://castor.org/xml-faq.html.
>>
>> Thanks
>> Werner
>>
>>> -----Original Message-----
>>> From: bin lin [mailto:[EMAIL PROTECTED] 
>>> Sent: Freitag, 17. März 2006 04:21
>>> To: [email protected]
>>> Subject: [castor-user] Do I need to write mapping
>> file for 
>>> existed object?
>>>
>>> Hi,
>>>
>>> I have an existed Java class which contains a
>> hashtable as 
>>> member variable.  
>>>
>>> Based on the "How-to" instruction on Castor
>> website, I wrote 
>>> a mapping file.  However, after experiement, I
>> found I can 
>>> translate this Java object to xml file back and
>> forth without 
>>> using mapping file.  Acutually my mapping file
>> contains many 
>>> typos but it doesn't seem take the effect during
>> translation 
>>> (no exception and translation seems correct.).
>>>
>>> Can anyone tell me if I need the mapping file in
>> this case?  Thank you
>>> ~Bin
>>>
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Tired of spam?  Yahoo! Mail has the best spam
>> protection 
>>> around http://mail.yahoo.com 
>>>
>>> -------------------------------------------------
>>> If you wish to unsubscribe from this list, please
>> send an 
>>> empty message to the following address:
>>>
>>> [EMAIL PROTECTED]
>>> -------------------------------------------------
>>>
>>>
>>>
>> -------------------------------------------------
>> If you wish to unsubscribe from this list, please
>> send an empty message to the following address:
>>
>> [EMAIL PROTECTED]
>> -------------------------------------------------
>>
>>
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please 
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
> 


-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to