-
JAXB Marshalling and XmlIDREF (2 messages)
- Posted by: Florian Thiel
- Posted on: October 19 2007 18:06 EDT
Hi! We're using JAXB 2.1 for XML processing and are currently planning to use the XmlID/XmlIDREF annotations to have references without containment (there are some cyclic references (parent/child) and many-to-many relations). Now I wonder how marshaling is supposed to work. Marshalling an object containing and IDREF-annotated property produces an XML file with the marshaled version of the object with the ID in place of the referenced object. The referenced object itself is not marshaled. On unmarshaling the XML again the property in the referencing object is null (as expected). The JSR only talks about preserving referential integrity, no word about how to cleanly marshal/unmarshal an XML structure with IDREFs. Am I supposed to resolve these references by myself? Is there a best-practice way to do it? Thanks in advance, FlorianThreaded Messages (2)
- Same problem by Michael Schmidt on January 13 2009 07:33 EST
- Mapping cyclic object references to XML using JAXB by Pawel Kepka on September 20 2010 08:39 EDT
-
Same problem[ Go to top ]
- Posted by: Michael Schmidt
- Posted on: January 13 2009 07:33 EST
- in response to Florian Thiel
Hi, does anybody know how this is issue should be approached. I have same problem and I couldn't find neither solutions nor even discussions about it. Thx Michael -
Mapping cyclic object references to XML using JAXB[ Go to top ]
- Posted by: Pawel Kepka
- Posted on: September 20 2010 08:39 EDT
- in response to Michael Schmidt
Take a look at this solution: http://justonjava.blogspot.com/2010/09/cyclic-object-references-with-jaxbe.html. It is not perfect but might work in some cases.