*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes XMLGregorianCalender maps to xs:anySimpleType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "XMLGregorianCalender maps to xs:anySimpleType" Watch "XMLGregorianCalender maps to xs:anySimpleType" New topic
Author

XMLGregorianCalender maps to xs:anySimpleType

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 723
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
Bartender

Joined: Apr 07, 2010
Posts: 1642
    
  23

Did you check the JAXB specifications for the reason?
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 723
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XMLGregorianCalender maps to xs:anySimpleType
 
Similar Threads
XML Schemas and CDATA
convert XMLGregorianCalender into java.util.date
getting royally SCREWED by xjc (twice!)
Import a schema
XSD nillable types