Hi,

[email protected] wrote:
> See Thread at: http://www.techienuggets.com/Detail?tx6824 Posted on
> behalf of a User
> 
> Hi Werner and Thnk you very much for your response,
> 
> You know I did find out yesterday what was the problem of Unmrshalling date
> type property in my XML file. So in my Person class I have a field named
> dateOfBirth type Date, and in my XML file of course I keep the same naming. 
>
> What I did is instead of
> umarshalling my XML file to get objects, I mashall my Object Person and see
> what is like the XML obtained from it, and found that the dateOfBirth
> property in the obtained  XML file, the name was
> <date-of-birth>xxxxxxxxxx</date-of-birth>.
As you are using 'introspection' mode of castor XML, there's default
naming conventions that lay out a set of rules how Java property names
are being converted to XML names. And as you are not using a mapping
file to make things more explicit, in your case the default naming
convention will apply.

[1]: http://castor.org/reference/html-single/index.html#d0e62
[2]: http://castor.org/reference/html-single/index.html#d0e1837

Alternatively, as explained in [2], you could switch to 'mixed' mode
using the 'org.exolab.castor.xml.naming' property in a custom
'castor.properties' file.

Cheers
Werner

> THen I change the name of the property in the XML file from dateOfBirth to
> date-of-birth and did unmarshall the XML file and things worked.
> I did further tests and see if this naming hapend just with Date type
> field, I did added a STring property in my XML clalled: String averageName;
> and ofcorse did add the field in the XML file as follow:
> <averageName>xxxx</averageName> and then unmarshall the file and found the
> property averageName was not set same as the issue that I had with Date
> attribute. SO I rename it in the XML file as:
> <average-name>xxxxxxx</average-name> then it's worked!
> 
> so i's something related with uppercase letters and Castor unmarshalling
> process ? I guess is the case !
> 
> THanks for your help and if you have any comment of the senario that I
> explained above will be great to share it with us !
> 
> Best Regards,
> Ghania
> 
> In Response To: 
> 
> Hi Every One,
> 
> IÂ’m new to Castor and IÂ’m using it to marshall and umrshall my XML file.
> I have an XML file that contain 2 elements objects, one of the object has 2
> fields ( String type and Date Type)
> Example of my XML file
> <?xml version=.0"  encoding="UTF-8"?>
> <people>
>       <Person>
>               <name>myName2009</name>
>               <dateOfBirth>12-11-2009</dateOfBirth>
>       </Person>
>       <Employee>
>               <name>mySecondName</name>
>               <employeeID>PR2009</employeeID>
>       </Employee>
> </people>
> 
> and my Person class hase 2 property fields, name (of type String) and
> dateOfBirth field (date type).
> When I unmarshall my XML file I got both objects but only the fields of
> type String that has the value, the other field with type Date is null(
> it's like the unmarshalling process just set the String element)
> 
> My question as IÂ’m not using any mapping file to unmarshall my XML file, 
> what should I do in my XML file to allow to Castor to unmarchall my XML
> file with all elements that was set in the XML file ?
> 
> If you can guide me on this or any link where I can read more about the
> unmarshalling without mapping file.
> Thanks in advance for your response,
> 
> My Best Regards,
> Ghania
> 
> 
> ---------------------------------------------------------------------
> 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


Reply via email to