Consider the following period : 2017-11-03 to 2017-11-06
- The XML has one element : TimePeriodCovered: v="2017-11-03T00:00Z/2017-11-06T00:00Z" which is a concatenation of two dates ;
- The Java object maps this field with two attributes (Date) : startPeriod & endPeriod
.java
public class foo implements Serializable {
private Date startPeriod;
private Date endPeriod;
...
}
.xsd
<xs:element name="container" >
<xs:complexType>
<xs:sequence>
<xs:element name="foo" type="fooType" />
...
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="fooType">
<xs:sequence>
<xs:element name="TimePeriodCovered" minOccurs="0" type="PeriodType" />
...
</xs:sequence>
</xs:complexType>
<xs:complexType name="PeriodType">
<xs:attribute name="v" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]Z?/[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]Z?" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
mapping.xml
I have absolutely no idea. What should it be ?