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]</email>
</Person>
 
- And the real result :
 
<Person id="P01">
      <name>Pham Thanh Quan</name>
      <phone>8431277</phone>
      <email>[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]</email>
        </Person>
        <Person id="P02">
                <name>Mark</name>
                <phone>835-3745</phone>
                <email>[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]</email>
        </Person>
        <Person>
                <id>P02</id>
                <name>Mark</name>
                <phone>835-3745</phone>
                <email>[EMAIL PROTECTED]</email>
        </Person>
</Person-list>
Please help !
Thanks and regards

Quan


Reply via email to