Below is the list of mappings from XSD data types to Java data types
XSD types | Java DataTypes |
byte | byte |
int | int |
integer | java.math.BigInteger |
decimal | java.math.BigDecimal |
long | long |
float | float |
double | double |
duration | javax.xml.datatype.Duration |
date | javax.xml.datatype.XMLGregorianCalendar |
dateTime | javax.xml.datatype.XMLGregorianCalendar |
string | java.lang.String |
nonNegativeInteger | java.math.BigInteger |
nonPositiveInteger | java.math.BigInteger |
unsignedByte | short |
unsignedInt | long |
unsignedLong | java.math.BigInteger |
unsignedShort | int |
anyURI | java.lang.String |
base64Binary | byte [] (byte array) |
boolean | boolean |
ENTITIES | List |
ENTITY | java.lang.String |
time | javax.xml.datatype.XMLGregorianCalendar |
gDay | javax.xml.datatype.XMLGregorianCalendar |
gMonth | javax.xml.datatype.XMLGregorianCalendar |
gYear | javax.xml.datatype.XMLGregorianCalendar |
gMonthDay | javax.xml.datatype.XMLGregorianCalendar |
gYearMonth | javax.xml.datatype.XMLGregorianCalendar |
Whatever data types are not there in Java JAXB has created appropriate datatypes in their API, for example, XMLGregorainCalendar. Now the question is how to convert it our facourite dataypes like java.util.Date or java.sql.Date or java.util.Calendar etc. You can probably write an Adaptor class which has static methods to do all these conversion.
No comments:
Post a Comment