Crate xsd_types

Source
Expand description

This crate aims at providing safe representations of XSD built-in data types.

§Usage

For each XSD datatype, this library provides two families of types: one representing the lexical space of the datatype (see the lexical module), and one representing the value space of the datatype (see the value module).

For instance, assume we wish to store the lexical representation of an XSD decimal datatype value. We can use the lexical::Decimal type (or its owned variant, lexical::DecimalBuf)

let string = "3.141592653589793";

// Parse the lexical representation (lexical domain).
let lexical_repr = xsd_types::lexical::Decimal::new(string).unwrap();

// Interprets the lexical representation (value domain).
use xsd_types::lexical::LexicalFormOf;
let value_repr: xsd_types::Decimal = lexical_repr.try_as_value().unwrap();

Of course it is possible to parse the value directly into the value domain using FromStr:

let value_repr: xsd_types::Decimal = "3.141592653589793".parse().unwrap();

§Any value

The Value type provides a simple way to represent any XSD value.

use xsd_types::{XSD_DATE, Datatype, Value};
let dt = Datatype::from_iri(XSD_DATE).unwrap();
let value: Value = dt.parse("1758-12-25").unwrap(); // Halley is back!

Re-exports§

pub use value::*;

Modules§

lexical
Lexical domain types.
value
Value domain types.

Structs§

ParseError
XSD value parse error.

Enums§

Datatype
XSD datatype (primitive or not).
DateTimeDatatype
DateTime datatype variants.
DateTimeValue
Any specialized DateTime value.
DecimalDatatype
Decimal datatype variants.
DecimalValue
Any specialized Decimal value.
DecimalValueRef
Any specialized Decimal value reference.
DurationDatatype
Duration datatype variants.
DurationValue
Any specialized Duration value.
IntDatatype
Int datatype variants.
IntValue
Any specialized Int value.
IntegerDatatype
Integer datatype variants.
IntegerValue
Any specialized Integer value.
IntegerValueRef
Any specialized Integer value reference.
LongDatatype
Long datatype variants.
LongValue
Any specialized Long value.
NCNameDatatype
NCName datatype variants.
NCNameValue
Any specialized NCName value.
NCNameValueRef
Any specialized NCName value reference.
NameDatatype
Name datatype variants.
NameValue
Any specialized Name value.
NameValueRef
Any specialized Name value reference.
NonNegativeIntegerDatatype
NonNegativeInteger datatype variants.
NonNegativeIntegerValue
Any specialized NonNegativeInteger value.
NonNegativeIntegerValueRef
Any specialized NonNegativeInteger value reference.
NonPositiveIntegerDatatype
NonPositiveInteger datatype variants.
NonPositiveIntegerValue
Any specialized NonPositiveInteger value.
NonPositiveIntegerValueRef
Any specialized NonPositiveInteger value reference.
NormalizedStringDatatype
NormalizedStr datatype variants.
NormalizedStringValue
Any specialized NormalizedStr value.
NormalizedStringValueRef
Any specialized NormalizedStr value reference.
ParseXsdError
XSD lexical parse error.
PrimitiveDatatype
XSD primitive datatype.
ShortDatatype
Short datatype variants.
ShortValue
Any specialized Short value.
StringDatatype
str datatype variants.
StringValue
Any specialized str value.
StringValueRef
Any specialized str value reference.
TokenDatatype
Token datatype variants.
TokenValue
Any specialized Token value.
TokenValueRef
Any specialized Token value reference.
UnsignedIntDatatype
UnsignedInt datatype variants.
UnsignedIntValue
Any specialized UnsignedInt value.
UnsignedLongDatatype
UnsignedLong datatype variants.
UnsignedLongValue
Any specialized UnsignedLong value.
UnsignedShortDatatype
UnsignedShort datatype variants.
UnsignedShortValue
Any specialized UnsignedShort value.
Value
Any XSD value.
ValueRef
Any XSD value reference.

Constants§

XSD_ANY_URI
http://www.w3.org/2001/XMLSchema#anyURI datatype IRI.
XSD_BASE64_BINARY
http://www.w3.org/2001/XMLSchema#base64Binary datatype IRI.
XSD_BOOLEAN
http://www.w3.org/2001/XMLSchema#boolean datatype IRI.
XSD_BYTE
http://www.w3.org/2001/XMLSchema#byte datatype IRI.
XSD_DATE
http://www.w3.org/2001/XMLSchema#date datatype IRI.
XSD_DATE_TIME
http://www.w3.org/2001/XMLSchema#dateTime datatype IRI.
XSD_DATE_TIME_STAMP
http://www.w3.org/2001/XMLSchema#dateTimeStamp datatype IRI.
XSD_DAY_TIME_DURATION
http://www.w3.org/2001/XMLSchema#dayTimeDuration datatype IRI.
XSD_DECIMAL
http://www.w3.org/2001/XMLSchema#decimal datatype IRI.
XSD_DOUBLE
http://www.w3.org/2001/XMLSchema#double datatype IRI.
XSD_DURATION
http://www.w3.org/2001/XMLSchema#duration datatype IRI.
XSD_ENTITIES
http://www.w3.org/2001/XMLSchema#ENTITIES datatype IRI.
XSD_ENTITY
http://www.w3.org/2001/XMLSchema#ENTITY datatype IRI.
XSD_FLOAT
http://www.w3.org/2001/XMLSchema#float datatype IRI.
XSD_G_DAY
http://www.w3.org/2001/XMLSchema#gDay datatype IRI.
XSD_G_MONTH
http://www.w3.org/2001/XMLSchema#gMonth datatype IRI.
XSD_G_MONTH_DAY
http://www.w3.org/2001/XMLSchema#gMonthDay datatype IRI.
XSD_G_YEAR
http://www.w3.org/2001/XMLSchema#gYear datatype IRI.
XSD_G_YEAR_MONTH
http://www.w3.org/2001/XMLSchema#gYearMonth datatype IRI.
XSD_HEX_BINARY
http://www.w3.org/2001/XMLSchema#hexBinary datatype IRI.
XSD_ID
http://www.w3.org/2001/XMLSchema#ID datatype IRI.
XSD_IDREF
http://www.w3.org/2001/XMLSchema#IDREF datatype IRI.
XSD_IDREFS
http://www.w3.org/2001/XMLSchema#IDREFS datatype IRI.
XSD_INT
http://www.w3.org/2001/XMLSchema#int datatype IRI.
XSD_INTEGER
http://www.w3.org/2001/XMLSchema#integer datatype IRI.
XSD_LANGUAGE
http://www.w3.org/2001/XMLSchema#language datatype IRI.
XSD_LONG
http://www.w3.org/2001/XMLSchema#long datatype IRI.
XSD_NAME
http://www.w3.org/2001/XMLSchema#Name datatype IRI.
XSD_NC_NAME
http://www.w3.org/2001/XMLSchema#NCName datatype IRI.
XSD_NEGATIVE_INTEGER
http://www.w3.org/2001/XMLSchema#negativeInteger datatype IRI.
XSD_NMTOKEN
http://www.w3.org/2001/XMLSchema#NMTOKEN datatype IRI.
XSD_NMTOKENS
http://www.w3.org/2001/XMLSchema#NMTOKENS datatype IRI.
XSD_NON_NEGATIVE_INTEGER
http://www.w3.org/2001/XMLSchema#nonNegativeInteger datatype IRI.
XSD_NON_POSITIVE_INTEGER
http://www.w3.org/2001/XMLSchema#nonPositiveInteger datatype IRI.
XSD_NORMALIZED_STRING
http://www.w3.org/2001/XMLSchema#normalizedString datatype IRI.
XSD_NOTATION
http://www.w3.org/2001/XMLSchema#NOTATION datatype IRI.
XSD_POSITIVE_INTEGER
http://www.w3.org/2001/XMLSchema#positiveInteger datatype IRI.
XSD_Q_NAME
http://www.w3.org/2001/XMLSchema#QName datatype IRI.
XSD_SHORT
http://www.w3.org/2001/XMLSchema#short datatype IRI.
XSD_STRING
http://www.w3.org/2001/XMLSchema#string datatype IRI.
XSD_TIME
http://www.w3.org/2001/XMLSchema#time datatype IRI.
XSD_TOKEN
http://www.w3.org/2001/XMLSchema#token datatype IRI.
XSD_UNSIGNED_BYTE
http://www.w3.org/2001/XMLSchema#unsignedByte datatype IRI.
XSD_UNSIGNED_INT
http://www.w3.org/2001/XMLSchema#unsignedInt datatype IRI.
XSD_UNSIGNED_LONG
http://www.w3.org/2001/XMLSchema#unsignedLong datatype IRI.
XSD_UNSIGNED_SHORT
http://www.w3.org/2001/XMLSchema#unsignedShort datatype IRI.
XSD_YEAR_MONTH_DURATION
http://www.w3.org/2001/XMLSchema#yearMonthDuration datatype IRI.

Traits§

ParseXsd
Parse a value directly from its XSD lexical form.

Type Aliases§

ParseXsdResult
XSD lexical parse result.