| Summary: | Schema Gen Optimization - When property name matches root element name with anonymous complex type | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> |
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.oxm-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
See example below: Customer @XmlRootElement @XmlType(name="") @XmlAccessorType(XmlAccessType.FIELD) public class Customer { private Address address; } Address @XmlRootElement @XmlType(name="") @XmlAccessorType(XmlAccessType.FIELD) public class Address { private String street; } Currently we generate the following XML schema: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="address"> <xsd:complexType> <xsd:sequence> <xsd:element name="street" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="customer"> <xsd:complexType> <xsd:sequence> <xsd:element name="address" minOccurs="0"> <xsd:complexType> <xsd:sequence> <xsd:element name="street" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> But we could generate, because in this case the element name for the property exactly matches the root element name for the Address class: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="address"> <xs:complexType> <xs:sequence> <xs:element name="street" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="customer"> <xs:complexType> <xs:sequence> <xs:element ref="address" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>