javaee / jaxb-spec

Formerly jsr222.java.net
Other
9 stars 16 forks source link

mapping XML schema for containment vs reference #22

Open glassfishrobot opened 20 years ago

glassfishrobot commented 20 years ago

Issue 22: mapping : Containment vs. reference

The following two approaches have been discussed in the expert group prior to the F2F.

1. JAXB 2.0 provides mechanisms which can be used to customize the generated XML schema to allow a reference to an object to be marshalled by containment or by reference.This approach has issues - not user friendly (e.g. can result in for cycles), hard to use etc. Nonetheless, this option does provide control to a user for customizing the generated schema and was thought worthwhile to explore this option further.

The discussion threads are here:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0402&L=jsr-222-eg&X=12E27C5E49150B4D5C&Y=sekhar.vajjhala@sun.com&P=3204

http://archives.java.sun.com/cgi-bin/wa?A2=ind0403&L=jsr-222-eg&X=12E27C5E49150B4D5C&Y=sekhar.vajjhala@sun.com&P=728

2. JAXB 2.0 determines based on the object graph the marshalling of an object by containment or reference. For example, the first time an object is marshalled, it is marshalled by containment. Subsequent references of object are marshalled by reference. This would be enabled by generating an XML schema with a that includes both an id or a reference to an id (defined elsewhere). See the thread

http://archives.java.sun.com/cgi-bin/wa?A2=ind0402&L=jsr-222-eg&X=12E27C5E49150B4D5C&Y=sekhar.vajjhala@sun.com&P=3204

Additionally the following approach was suggested at the JAXB 2.0 F2F.

3. A third approach was suggested in JAXB 2.0 F2F by Steve Brodsky. The discussion is in bullet 13 in the F2F minutes:

https://www.dev.java.net/files/documents/919/3776/f2f-minutes.txt

The summary of this approach is: XML instance could just list every single object at the top-level and all the references can be ID/IDREF (since Java does not distinguish between containment vs. reference). The generated XML schema might not be useful or meaningful in some cases. In such a case, Java classes have to be customized to produce the desired XML schema i.e. use approach 1 noted in bullet item 1 above.

Environment

Operating System: All Platform: All

Affected Versions

[2.0 draft]

glassfishrobot commented 20 years ago

Reported by sekhar

glassfishrobot commented 20 years ago

sekhar said: Changed Issue type from "DEFECT" to "FEATURE"

glassfishrobot commented 20 years ago

sekhar said: Updating the status to follow the lifecycle issue outlined in the jaxb20-note-0007.txt.

glassfishrobot commented 20 years ago

Was assigned to sekhar

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JSR222-22