| Summary: | Enhancement: Expand @XmlDescriminatorNode to support child elements | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | NEW --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | dma_k, tompasik |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Will this extension also support "node presence" check? For example, for given type:
<xs:complexType>
<xs:sequence>
<xs:element name="ApplicationNumber" type="xs:string" />
<xs:element name="CountryCode" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
I would like to model two Java class:
@XmlRootElement(name="Application")
class BasicApplication {
@XmlElement(name = "ApplicationNumber", required = true)
String applicationNumber;
}
and
@XmlRootElement(name="Application")
@XmlDiscriminatorNode("CountryCode")
class Application extends BasicApplication {
@XmlElement(name = "CountryCode")
String countryCode;
}
and create "Application" instance if "<CountryCode>...</CountryCode>" is present.
Any chance of having the @XmlDiscriminatorNode value be an arbitrary xpath?
I have a legacy XML that I would like to map:
<MESSAGE>
<HEADER>
<TYPE></TYPE>
</HEADER>
<DATA>
...
</DATA>
</MESSAGE>
Basically there are no types in the XML but the contents of the MESSAGE/DATA element are dependent on the value of MESSAGE/HEADER/TYPE. The DATA element is itself typed but there are no type indicators on it as immediate children (attributes or elements).
I'd like to either:
- type the whole Message based on the MESSAGE/HEADER/TYPE - concrete values in this element correspond to whole message types, one would have to be able to specify xpath expressions operating deeper than one level down, or
- type the DATA element based on existence of child elements with certain local names - I guess this could be done using an xpath expression like boolean(/CHILD).
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Currently @XmlDescriminatorNode support is restricted to attribute nodes. Support should be expanded to include child elements: Currently Supported: - @XmlDiscriminatorNode("@classifier") Add Support For: - @XmlDiscriminatorNode("classifier/text()") - @XmlDiscriminatorNode("grouping-element/classifier/text()") - @XmlDiscriminatorNode("grouping-element/@classifier")