Hi Quan,
See if this property is set in castor.properties accordingly
 

# Defines the NodeType for use with Java primitive types (int, long,
# boolean, etc). This value is only used by the Introspector.
# valid values are either "attribute" or "element". By default
# all primitives are marshalled as attributes. Simply uncomment
# the following line to change the NodeType to element.
#
org.exolab.castor.xml.introspector.primitive.nodetype=element

Zabi.

-----Original Message-----
From: Pham Thanh Quan [mailto:[EMAIL PROTECTED]]
Sent: Monday, 27 August 2001 15:39
To: [EMAIL PROTECTED]
Subject: [castor-dev] Marshalling using castor


Hi all,

I have classes Person and List, which contains a Vector of persons, when i unmarshal 
and marshal a person, it's OK. When i unmarshal the file list.xml to an object of the 
class List, it's also OK, but when i marshal an object of the class List to an .xml 
file, he attribute of persons becomes element.

For example, when I marshal an object of Person

- The expected result :
 
<Person id="P01">
      <name>Pham Thanh Quan</name>
      <phone>8431277</phone>
      <email> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> </email>
</Person>
 
- And the real result :
 
<Person id="P01">
      <name>Pham Thanh Quan</name>
      <phone>8431277</phone>
      <email> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> </email>
</Person>

When I marshal an object of List

-The expected result :
 
<List>
        <Person id="P01">
                <name>John</name>
                <phone>832-1723</phone>
                <email> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> </email>
        </Person>
        <Person id="P02">
                <name>Mark</name>
                <phone>835-3745</phone>
                <email> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> </email>
        </Person>
</Person-list>
 
-But the real result :
 
<List>
        <Person>
                <id>P01</id>
                <name>John</name>
                <phone>832-1723</phone>
                <email> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> </email>
        </Person>
        <Person>
                <id>P02</id>
                <name>Mark</name>
                <phone>835-3745</phone>
                <email> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> </email>
        </Person>
</Person-list>


Please help !
Thanks and regards

Quan

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to