• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XMLGregorianCalender maps to xs:anySimpleType

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In MZ's version 5 notes, p 137, it says javax.xml.datatype.XMLGregorianCalender maps to xs:anySimpleType in a schema.
It says "It is (XMLGregorianCalender)statically mapped to xs:anySimpleType, the common schema type from which all XML schema calendar types are derived."

But why XMLGregorianCalender won't map to xs:datetime?
For me, it makes more sense to map the Calender object to datatime instead of anySimpleType.

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2534
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the JAXB specifications for the reason?
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found this site:
http://docs.oracle.com/cd/E19879-01/820-1072/ahihf/index.html
We have to annotation XMLGregorianCalender with @XmlSchemaType in order to map XMLGregorianCalender to xs:dateTime.

If we don't annotate it wit @XmlSchemaType, the schema type of the XMLGregorianCalender is not known until runtime. So, it can only be mapped to xs:anySimpleType.
This is from :http://markmail.org/message/bpplfv5ytvrtp7fp

So personally, I think it is more appropriate to annotate XMLGregorianCalender with @XmlSchemaType (name="dateTime").
I think it is not recommended not to annotate the Calendar object in Java, as it will be mapped by xs:anySimpleType.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic