JAXB Marshalling and XmlIDREF


XML & Web services: JAXB Marshalling and XmlIDREF

  1. JAXB Marshalling and XmlIDREF (2 messages)

    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, Florian
  2. Same problem[ Go to top ]

    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
  3. 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.