Last active
August 29, 2015 14:15
-
-
Save drdozer/5b76df6534f2bae88d54 to your computer and use it in GitHub Desktop.
xsd built-in data types in scala - a sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait XsdSimpleTypes { | |
type anySimpleType | |
type string | |
type duration | |
type dateTime | |
type time | |
type date | |
type gYearMonth | |
type gYear | |
type gMonthDay | |
type gDay | |
type gMonth | |
type boolean | |
type base64Binary | |
type hexBinary | |
type float | |
type decimal | |
type double | |
type anyURI | |
type QName | |
type NOTATION | |
type normalizedString | |
type token | |
type language | |
type Name | |
type NMTOKEN | |
type NCName | |
type ID | |
type IDREF | |
type ENTITY | |
type IDREFS | |
type ENTITIES | |
type integer | |
type nonPositiveInteger | |
type long | |
type nonNegativeInteger | |
type negativeInteger | |
type int | |
type short | |
type byte | |
type unsignedLong | |
type positiveInteger | |
type unsignedInt | |
type unsignedShort | |
type unsignedByte | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait XsdSimpleTypesHiearachy[XSD <: XsdSimpleTypes] { | |
def derivedFrom_anySimpleType: XSD#anySimpleType >:~> Coproduct.` | |
XSD#string, | |
XSD#duration, | |
XSD#dateTime, | |
XSD#time, | |
XSD#date, | |
XSD#gYearMonth, | |
XSD#gYear, | |
XSD#gMonthDay, | |
XSD#gDay, | |
XSD#gMonth, | |
XSD#boolean, | |
XSD#base64Binary, | |
XSD#hexBinary, | |
XSD#float, | |
XSD#decimal, | |
XSD#double, | |
XSD#anyURI, | |
XSD#QName, | |
XSD#NOTATION`.T | |
def derivedFrom_string: | |
XSD#string >:~> XSD#normalizedString | |
def derivedFrom_normalizedString: | |
XSD#normalizedString >:~> XSD#token | |
def derivedFrom_token: | |
XSD#token >:~> Coproduct.`XSD#language, XSD#Name, XSD#NMTOKEN)`.T | |
def derivedFrom_Name: | |
XSD#Name >:~> XSD#NCName | |
def derivedFrom_NCName: | |
XSD#NCName >:~> Coproduct.`XSD#ID, XSD#IDREF, XSD#ENTITY`.T | |
def listOfIDREF: | |
XSD#IDREF >_*> XSD#IDREFS | |
def listOfENTITY: | |
XSD#ENTITY >_*> XSD#ENTITIES | |
def derivedFrom_decimal: | |
XSD#decimal >:~> XSD#integer | |
def derivedFrom_integer: | |
XSD#integer >:~> Coproduct.`XSD#nonPositiveInteger, XSD#long, XSD#nonNegativeInteger`.T | |
def derivedFrom_nonPositiveInteger: | |
XSD#nonPositiveInteger >:~> XSD#negativeInteger | |
def derivedFrom_long: | |
XSD#long >:~> XSD#int | |
def derivedFrom_int: | |
XSD#int >:~> XSD#short | |
def derivedFrom_short: | |
XSD#short >:~> XSD#byte | |
def derivedFrom_nonNegativeInteger: | |
XSD#nonNegativeInteger >:~> Coproduct.`XSD#unsignedLong, XSD#positiveInteger`.T | |
def derivedFrom_unsignedLong: | |
XSD#unsignedLong >:~> XSD#unsignedInt | |
def derivedFrom_unsignedInt: | |
XSD#unsignedInt >:~> XSD#unsignedShort | |
def derivedFrom_unsignedShort: | |
XSD#unsignedShort >:~> XSD#unsignedByte | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes:
The type
T >_*> X
witnesses thatX
is derived fromT
as a list.In the xsd serialized literal form, this will be values matching the serialized literal form of
T
separated by whitespace. In the scala data space, this will most likely map down to some collection type. However, it may map down to tuples or even a case class, in situations were that makes sense.