Maybe I might not explain my issue clearly. Let me try it again.
The domain model I have can be declared like this:
public class Person
{
private Set<Item> personalItems;
}
If I define the mapping like this, which similar to tutorial:
<collection field="personalItems" type="java.util.HashSet" item-type="Item" />
The XML file would looks something like this:
<person>
<item>Scissor</item>
<item>Screwdiver</item>
</person>
You can see that the XML map item in the collection directly under person tag.
But what I would like to have is, instead, have a tag denote the collection -
personalItems before item tags. Like this:
<person>
<personal-items>
<item>Scissor</item>
<item>Screwdiver</item>
</personal-item>
<person>
How should I define the binding in order to achieve this?
Regards,
Vairoj
Using the same element name in different places with different contents
is going to be difficult. If you could rename the outermost <person> to
something else then it should be easy. If you can post your binding for
the second xml along with any errors or whatever output you're getting
it will be easier to troubleshoot your issues.
Mocky
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vairoj A.
Sent: Wednesday, October 19, 2005 6:30 AM
To: [email protected]
Subject: [jibx-users] Collection Mapping
Hi,
I have a question about mapping Collection attribute. Says I have the
the following class:
Person {
private Set<Person> employees;
}
And defines mapping like this:
<collection field="employees" type="java.util.HashSet"
item-type="Person" />
will results in XML file like this:
<person>
<person>
</person>
<person>
</person>
</person>
What if I would like the XML file to look like this:
<person>
<employees>
<person>
</person>
<person>
</person>
</employee>
</person>
How should I define the mapping to achieve this kind of structure?
Regards,
Vairoj
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users