Details
-
Type: Sub-task
-
Status: Closed
-
Priority: Major
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Converters
-
Labels:None
-
JDK version and platform:1.5 for Windows
Description
I am coming back to the possibilty of having access to the parent object while unmarshalling...May be the solution is not the currentObject() method or the parentObject() method, but I use successfully XStream while writing my own converters, and i have not found any solution for the problem below:
My XML is something like:
<Map>
<Catalog>
<Member id="member1" ............></Member>
<Member id="member2" ............></Member>
<Member id="member3" ............></Member>
<Member id="member4" ............></Member>
</Catalog>
.......
<Item>
<CatalogMember memberId="member2" ....... </CatalogMember>
....
</Item>
...
</Map>
While the unmarshalling of CatalogMember, I need to access the <Catalog> object (may be from the top level ?) to find the correct <Member> that matches the id... so I would do a :
Catalog catalog = ????? HERE something...
Member member = catalog.getMember(reader.getAttribute("memberId");
CatalogMember cm = new CatalogMember(member ....);
Am I wrong or does it exist another solution that I could use (through the context ?)
Hello Hervé, I am closing this issue, since it is a question how to use XStream and has nothing to do with any kind of bug report. Therefore it clearly does not belong into JIRA, but you're welcome to ask your question and discuss solutions on the user's list.