Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/DesignDocs/293925/PathBasedMappings"

 
(12 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
=== Decision Point 1:  <code>xml-attribute</code>/<code>xml-element</code> vs. <code>xml-element-wrapper</code> ===
 
=== Decision Point 1:  <code>xml-attribute</code>/<code>xml-element</code> vs. <code>xml-element-wrapper</code> ===
  
We are currently considering two possible options for supporting path-based mappings:
+
There are three possible options for supporting path-based mappings:
 
* Utilize the <code>xml-attribute</code> and <code>xml-element</code> structures
 
* Utilize the <code>xml-attribute</code> and <code>xml-element</code> structures
 
** Issue: if this apporach is taken, what is the expected behavior when an <code>xml-element-wrapper</code> is used with an <code>xml-element</code> that has the path set?
 
** Issue: if this apporach is taken, what is the expected behavior when an <code>xml-element-wrapper</code> is used with an <code>xml-element</code> that has the path set?
Line 14: Line 14:
 
** For this approach to work, we will have to enable use with single-valued properties and <code>xml-attribute</code>
 
** For this approach to work, we will have to enable use with single-valued properties and <code>xml-attribute</code>
  
=== Decision Point 2:  <code>name</code> overload vs. <code>xpath</code> vs. <code>name</code> + <code>grouping-element</code> ===
+
The preferred approach is to utilize the <code>xml-attribute</code> and <code>xml-element</code> structures.
  
We are currently considering three possible methods of specifying the path for a given mapping:
+
=== Decision Point 2:  <code>name</code> overload vs. <code>xml-path</code> vs. <code>name</code> + <code>grouping-element</code> ===
 +
 
 +
We will need to consider three possible methods of specifying the path for a given mapping:
 
* Overload the <code>name</code> attribute
 
* Overload the <code>name</code> attribute
 
** This is the most simple approach, as no new attributes/elements need to be introduced.
 
** This is the most simple approach, as no new attributes/elements need to be introduced.
Line 22: Line 24:
 
*** <code>name="projects/project/id"</code>
 
*** <code>name="projects/project/id"</code>
 
** Issue: this approach would require use of a standard mechanism in a non-standard way - is this acceptable?
 
** Issue: this approach would require use of a standard mechanism in a non-standard way - is this acceptable?
* Add a new <code>xpath</code> attribute
+
* Add a new <code>xml-path</code> attribute
** With this approach, the <code>xpath</code> would contain the entire path, i.e.:
+
** With this approach, the <code>xml-path</code> would contain the entire path, i.e.:
*** <code>xpath="projects/project/id"</code>
+
*** <code>xml-path="projects/project/id"</code>
**Issue: if both <code>name</code> and <code>xpath</code> are set, which takes precedence?
+
**Issue: if both <code>name</code> and <code>xml-path</code> are set, which takes precedence?
 
* Combine <code>name</code> with a new <code>grouping-element</code> attribute
 
* Combine <code>name</code> with a new <code>grouping-element</code> attribute
 
** With this approach a grouping element would be combined with the name to get the entire path, i.e.:
 
** With this approach a grouping element would be combined with the name to get the entire path, i.e.:
 
*** <code>name="id" grouping-element="projects/project"</code>
 
*** <code>name="id" grouping-element="projects/project"</code>
  
== Other Issues  ==
+
The preferred approach would be to Add a new <code>xml-path</code> attribute
* Namespaces
+
 
** What is the expected behavior when a namespace is set with an XPath? For example, if we have <code><xml-element java-attribute="firstName" xml-path="myname/names/fname" namespace="www.example.com" /></code> to which element is the namespace applied, if any?
+
=== Decision Point 3: Optional Element Usage ===
 +
 
 +
If use of <code>xml-element-wrapper</code> is chosen in Decision Point 1 above, what will the expected behavior be when <code>namespace</code>, <code>nillable</code>, and/or <code>required</code> is set in addition to an XPath?
 +
 
 +
Regarding <code>namespace</code>, the preferred approach is to apply the namespace to any path element that isn't already prefixed.
 +
Regarding <code>nillable</code>, and/or <code>required</code>, the preferred approach is to apply these to the last path element.

Latest revision as of 06:41, 4 March 2010

Path-based Mapping Support

Provide support for path-based mappings.

Design Decisions

Decision Point 1: xml-attribute/xml-element vs. xml-element-wrapper

There are three possible options for supporting path-based mappings:

  • Utilize the xml-attribute and xml-element structures
    • Issue: if this apporach is taken, what is the expected behavior when an xml-element-wrapper is used with an xml-element that has the path set?
  • Utilize the xml-element-wrapper structure
    • For this approach to work, we will have to enable use with single-valued properties and xml-attribute

The preferred approach is to utilize the xml-attribute and xml-element structures.

Decision Point 2: name overload vs. xml-path vs. name + grouping-element

We will need to consider three possible methods of specifying the path for a given mapping:

  • Overload the name attribute
    • This is the most simple approach, as no new attributes/elements need to be introduced.
    • name can be used to set the path as follows:
      • name="projects/project/id"
    • Issue: this approach would require use of a standard mechanism in a non-standard way - is this acceptable?
  • Add a new xml-path attribute
    • With this approach, the xml-path would contain the entire path, i.e.:
      • xml-path="projects/project/id"
    • Issue: if both name and xml-path are set, which takes precedence?
  • Combine name with a new grouping-element attribute
    • With this approach a grouping element would be combined with the name to get the entire path, i.e.:
      • name="id" grouping-element="projects/project"

The preferred approach would be to Add a new xml-path attribute

Decision Point 3: Optional Element Usage

If use of xml-element-wrapper is chosen in Decision Point 1 above, what will the expected behavior be when namespace, nillable, and/or required is set in addition to an XPath?

Regarding namespace, the preferred approach is to apply the namespace to any path element that isn't already prefixed. Regarding nillable, and/or required, the preferred approach is to apply these to the last path element.

Back to the top