Class XMLDatatypeUtil
java.lang.Object
org.eclipse.rdf4j.model.datatypes.XMLDatatypeUtil
Provides methods for handling the standard XML Schema datatypes.
- Author:
- Arjohn Kampman
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Replaces all contiguous sequences of #x9 (tab), #xA (line feed) and #xD (carriage return) with a single #x20 (space) character, and removes any leading and trailing whitespace characters, as specified for whiteSpace facet collapse.static int
static int
compareBytes
(String int1, String int2) static int
compareCanonicalDecimals
(String dec1, String dec2) Compares two canonical decimals to each other.static int
compareCanonicalDoubles
(String double1, String double2) Compares two canonical doubles to eachother.static int
compareCanonicalFloats
(String float1, String float2) Compares two canonical floats to each other.static int
compareCanonicalFPNumbers
(String float1, String float2) Compares two canonical floating point numbers to each other.static int
compareCanonicalIntegers
(String int1, String int2) Compares two canonical integers to each other.static int
compareDateTime
(String value1, String value2) Compares two dateTime objects.static int
compareDecimals
(String dec1, String dec2) Compares two decimals to eachother.static int
compareDoubles
(String double1, String double2) Compares two doubles to each other.static int
compareFloats
(String float1, String float2) Compares two floats to each other.static int
compareFPNumbers
(String fp1, String fp2) Compares two floating point numbers to eachother.static int
compareIntegers
(String int1, String int2) Compares two integers to each other.static int
compareInts
(String int1, String int2) static int
compareLongs
(String int1, String int2) static int
compareNegativeIntegers
(String int1, String int2) static int
compareNonNegativeIntegers
(String int1, String int2) static int
compareNonPositiveIntegers
(String int1, String int2) static int
comparePositiveIntegers
(String int1, String int2) static int
compareShorts
(String int1, String int2) static int
compareUnsignedBytes
(String int1, String int2) static int
compareUnsignedInts
(String int1, String int2) static int
compareUnsignedLongs
(String int1, String int2) static int
compareUnsignedShorts
(String int1, String int2) static boolean
isBuiltInDatatype
(IRI datatype) Checks whether the supplied datatype is a built-in XML Schema datatype.static boolean
isCalendarDatatype
(IRI datatype) Checks whether the supplied datatype is equal to xsd:dateTime, xsd:date, xsd:time, xsd:gYearMonth, xsd:gMonthDay, xsd:gYear, xsd:gMonth or xsd:gDay.These are the primitive datatypes that represent dates and/or times.static boolean
isDecimalDatatype
(IRI datatype) Checks whether the supplied datatype is equal to xsd:decimal or one of the built-in datatypes that is derived from xsd:decimal.static boolean
isDerivedDatatype
(IRI datatype) Checks whether the supplied datatype is a derived XML Schema datatype.static boolean
isDurationDatatype
(IRI datatype) Checks whether the supplied datatype is equal to xsd:duration, xsd:dayTimeDuration, xsd:yearMonthDuration.static boolean
isFloatingPointDatatype
(IRI datatype) Checks whether the supplied datatype is equal to xsd:float or xsd:double.static boolean
isIntegerDatatype
(IRI datatype) Checks whether the supplied datatype is equal to xsd:integer or one of the built-in datatypes that is derived from xsd:integer.static boolean
isNumericDatatype
(IRI datatype) Checks whether the supplied datatype is a numeric datatype, i.e.if it is equal to xsd:float, xsd:double, xsd:decimal or one of the datatypes derived from xsd:decimal.static boolean
isOrderedDatatype
(IRI datatype) Checks whether the supplied datatype is ordered.The values of an ordered datatype can be compared to each other using operators like < and >.static boolean
isPrimitiveDatatype
(IRI datatype) Checks whether the supplied datatype is a primitive XML Schema datatype.static boolean
isValidAnyURI
(String value) Determines if the supplied value is an Internationalized Resource Identifier Reference (IRI).static boolean
isValidBoolean
(String value) Verifies if the supplied lexical value is a valid boolean or not.static boolean
isValidByte
(String value) Verifies if the supplied lexical value is a valid byte or not.static boolean
isValidDate
(String value) Determines if the supplied value is a valid xsd:date string.static boolean
isValidDateTime
(String value) Verifies if the supplied lexical value is a valid date-time.static boolean
isValidDateTimeStamp
(String value) Verifies if the supplied lexical value is a valid date-timestamp.static boolean
isValidDayTimeDuration
(String value) Verifies if the supplied lexical value is a valid day-time duration ot not.static boolean
isValidDecimal
(String value) Verifies if the supplied lexical value is a valid decimal or not.static boolean
isValidDouble
(String value) Verifies if the supplied lexical value is a valid double or not.static boolean
isValidDuration
(String value) Verifies if the supplied lexical value is a valid duration.static boolean
isValidFloat
(String value) Verifies if the supplied lexical value is a valid float or not.static boolean
isValidGDay
(String value) Determines if the supplied value is a valid xsd:gDay string.static boolean
isValidGMonth
(String value) Determines if the supplied value is a valid xsd:gMonth string.static boolean
isValidGMonthDay
(String value) Determines if the supplied value is a valid xsd:gMonthDay string.static boolean
isValidGYear
(String value) Determines if the supplied value is a valid xsd:gYear string.static boolean
isValidGYearMonth
(String value) Determines if the supplied value is a valid xsd:gYearMonth string.static boolean
isValidInt
(String value) Verifies if the supplied lexical value is a valid integer or not.static boolean
isValidInteger
(String value) Verifies if the supplied lexical value is a valid integer or not.static boolean
isValidLong
(String value) Verifies if the supplied lexical value is a valid long or not.static boolean
isValidNegativeInteger
(String value) Verifies if the supplied lexical value is a valid negative integer or not.static boolean
isValidNonNegativeInteger
(String value) Verifies if the supplied lexical value is a valid non-negative integer or not.static boolean
isValidNonPositiveInteger
(String value) Verifies if the supplied lexical value is a valid non-positive integer or not.static boolean
isValidPositiveInteger
(String value) Verifies if the supplied lexical value is a valid positive integer or not.static boolean
isValidQName
(String value) Determines if the supplied value is a valid xsd:QName string.static boolean
isValidShort
(String value) Verifies if the supplied lexical value is a valid short or not.static boolean
isValidTime
(String value) Determines if the supplied value is a valid xsd:time string.static boolean
isValidUnsignedByte
(String value) Verifies if the supplied lexical value is a valid unsigned byte or not.static boolean
isValidUnsignedInt
(String value) Verifies if the supplied lexical value is a valid unsigned int.static boolean
isValidUnsignedLong
(String value) Verifies if the supplied lexical value is a valid unsigned long or not.static boolean
isValidUnsignedShort
(String value) Verifies if the supplied lexical value is a valid unsigned short or not.static boolean
isValidValue
(String value, CoreDatatype datatype) static boolean
isValidValue
(String value, CoreDatatype.XSD datatype) static boolean
isValidValue
(String value, IRI datatype) Verifies if the supplied lexical value is valid for the given datatype.static boolean
isValidYearMonthDuration
(String value) Verifies if the supplied lexical value is a valid year-month duration.static String
normalize
(String value, CoreDatatype.XSD datatype) static String
Normalizes the supplied value according to the normalization rules for the supplied datatype.static String
normalizeBoolean
(String value) Normalizes a boolean value to its canonical representation.static String
normalizeByte
(String value) Normalizes an xsd:byte.static String
normalizeDateTime
(String value) Normalizes an xsd:dateTime.static String
normalizeDecimal
(String decimal) Normalizes a decimal to its canonical representation.static String
normalizeDouble
(String value) Normalizes a double to its canonical representation.static String
normalizeFloat
(String value) Normalizes a float to its canonical representation.static String
normalizeFPNumber
(String value) Normalizes a floating point number to its canonical representation.static String
normalizeInt
(String value) Normalizes an xsd:int.static String
normalizeInteger
(String value) Normalizes an integer to its canonical representation.static String
normalizeLong
(String value) Normalizes an xsd:long.static String
normalizeNegativeInteger
(String value) Normalizes an xsd:negativeInteger.static String
Normalizes an xsd:nonNegativeInteger.static String
Normalizes an xsd:nonPositiveInteger.static String
normalizePositiveInteger
(String value) Normalizes an xsd:positiveInteger.static String
normalizeShort
(String value) Normalizes an xsd:short.static String
normalizeUnsignedByte
(String value) Normalizes an xsd:unsignedByte.static String
normalizeUnsignedInt
(String value) Normalizes an xsd:unsignedInt.static String
normalizeUnsignedLong
(String value) Normalizes an xsd:unsignedLong.static String
normalizeUnsignedShort
(String value) Normalizes an xsd:unsignedShort.static boolean
Parses the supplied xsd:boolean string and returns its value.static byte
Parses the supplied xsd:byte string and returns its value.static XMLGregorianCalendar
Parses the supplied calendar value string and returns its value.static BigDecimal
Parses the supplied decimal/floating point string and returns its value.static double
Parses the supplied xsd:double string and returns its value.static Duration
Parses the supplied xsd:duration value string and returns its value.static float
parseFloat
(String s) Parses the supplied xsd:float string and returns its value.static int
Parses the supplied xsd:int strings and returns its value.static BigInteger
Parses the supplied xsd:integer string and returns its value.static long
Parses the supplied xsd:long string and returns its value.static short
parseShort
(String s) Parses the supplied xsd:short string and returns its value.static CoreDatatype.XSD
qnameToCoreDatatype
(QName qname) static IRI
qnameToURI
(QName qname) Maps a datatype QName from the javax.xml.namespace package to an XML Schema 1.0 URI for the corresponding datatype.static String
-
Field Details
-
POSITIVE_INFINITY
- See Also:
-
NEGATIVE_INFINITY
- See Also:
-
NaN
- See Also:
-
-
Constructor Details
-
XMLDatatypeUtil
public XMLDatatypeUtil()
-
-
Method Details
-
isPrimitiveDatatype
Checks whether the supplied datatype is a primitive XML Schema datatype.- Parameters:
datatype
-- Returns:
- true if the datatype is a primitive type
-
isDerivedDatatype
Checks whether the supplied datatype is a derived XML Schema datatype.- Parameters:
datatype
-- Returns:
- true if the datatype is a derived type
-
isBuiltInDatatype
Checks whether the supplied datatype is a built-in XML Schema datatype.- Parameters:
datatype
-- Returns:
- true if it is a primitive or derived XML Schema type
-
isNumericDatatype
Checks whether the supplied datatype is a numeric datatype, i.e.if it is equal to xsd:float, xsd:double, xsd:decimal or one of the datatypes derived from xsd:decimal.- Parameters:
datatype
-- Returns:
- true of it is a decimal or floating point type
-
isDecimalDatatype
Checks whether the supplied datatype is equal to xsd:decimal or one of the built-in datatypes that is derived from xsd:decimal.- Parameters:
datatype
-- Returns:
- true if it is a decimal datatype
-
isIntegerDatatype
Checks whether the supplied datatype is equal to xsd:integer or one of the built-in datatypes that is derived from xsd:integer.- Parameters:
datatype
-- Returns:
- true if it is an integer type
-
isFloatingPointDatatype
Checks whether the supplied datatype is equal to xsd:float or xsd:double.- Parameters:
datatype
-- Returns:
- true if it is a floating point type
-
isCalendarDatatype
Checks whether the supplied datatype is equal to xsd:dateTime, xsd:date, xsd:time, xsd:gYearMonth, xsd:gMonthDay, xsd:gYear, xsd:gMonth or xsd:gDay.These are the primitive datatypes that represent dates and/or times.- Parameters:
datatype
-- Returns:
- true if it is a calendar type
- See Also:
-
isDurationDatatype
Checks whether the supplied datatype is equal to xsd:duration, xsd:dayTimeDuration, xsd:yearMonthDuration. These are the datatypes that represents durations.- Parameters:
datatype
-- Returns:
- true if it is a duration type
- See Also:
-
isOrderedDatatype
Checks whether the supplied datatype is ordered.The values of an ordered datatype can be compared to each other using operators like < and >.- Parameters:
datatype
-- Returns:
- true if the datatype is ordered
-
isValidValue
Verifies if the supplied lexical value is valid for the given datatype.- Parameters:
value
- a lexical valuedatatype
- an XML Schema datatatype.- Returns:
- true if the supplied lexical value is valid, false otherwise.
-
isValidValue
-
isValidValue
-
isValidDecimal
Verifies if the supplied lexical value is a valid decimal or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidInteger
Verifies if the supplied lexical value is a valid integer or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidNegativeInteger
Verifies if the supplied lexical value is a valid negative integer or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidNonPositiveInteger
Verifies if the supplied lexical value is a valid non-positive integer or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidNonNegativeInteger
Verifies if the supplied lexical value is a valid non-negative integer or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidPositiveInteger
Verifies if the supplied lexical value is a valid positive integer or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidLong
Verifies if the supplied lexical value is a valid long or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidInt
Verifies if the supplied lexical value is a valid integer or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidShort
Verifies if the supplied lexical value is a valid short or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidByte
Verifies if the supplied lexical value is a valid byte or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidUnsignedLong
Verifies if the supplied lexical value is a valid unsigned long or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidUnsignedInt
Verifies if the supplied lexical value is a valid unsigned int.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidUnsignedShort
Verifies if the supplied lexical value is a valid unsigned short or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidUnsignedByte
Verifies if the supplied lexical value is a valid unsigned byte or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidFloat
Verifies if the supplied lexical value is a valid float or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidDouble
Verifies if the supplied lexical value is a valid double or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidBoolean
Verifies if the supplied lexical value is a valid boolean or not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidDuration
Verifies if the supplied lexical value is a valid duration.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidDayTimeDuration
Verifies if the supplied lexical value is a valid day-time duration ot not.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidYearMonthDuration
Verifies if the supplied lexical value is a valid year-month duration.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidDateTime
Verifies if the supplied lexical value is a valid date-time.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidDateTimeStamp
Verifies if the supplied lexical value is a valid date-timestamp.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidDate
Determines if the supplied value is a valid xsd:date string.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidTime
Determines if the supplied value is a valid xsd:time string.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidGDay
Determines if the supplied value is a valid xsd:gDay string.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidGMonth
Determines if the supplied value is a valid xsd:gMonth string.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidGMonthDay
Determines if the supplied value is a valid xsd:gMonthDay string.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidGYear
Determines if the supplied value is a valid xsd:gYear string.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidGYearMonth
Determines if the supplied value is a valid xsd:gYearMonth string.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidQName
Determines if the supplied value is a valid xsd:QName string. Note that this method only checks for syntax errors in the supplied string itself. It does not validate that the prefix is a declared and in-scope namespace prefix.- Parameters:
value
-- Returns:
- true if valid, false otherwise
-
isValidAnyURI
Determines if the supplied value is an Internationalized Resource Identifier Reference (IRI). An anyURI value can be absolute or relative, and may have an optional fragment identifier (i.e., it may be an IRI Reference). This type should be used when the value fulfills the role of an IRI, as defined in [RFC 3987] or its successor(s) in the IETF Standards Track.- Parameters:
value
-- Returns:
- true if a valid IRI, false otherwise
-
normalize
Normalizes the supplied value according to the normalization rules for the supplied datatype.- Parameters:
value
- The value to normalize.datatype
- The value's datatype.- Returns:
- The normalized value if there are any (supported) normalization rules for the supplied datatype, or the original supplied value otherwise.
- Throws:
IllegalArgumentException
- If the supplied value is illegal considering the supplied datatype.
-
normalize
-
normalizeBoolean
Normalizes a boolean value to its canonical representation. More specifically, the values 1 and 0 will be normalized to the canonical values true and false, respectively. Supplied canonical values will remain as is.- Parameters:
value
- The boolean value to normalize.- Returns:
- The normalized value.
- Throws:
IllegalArgumentException
- If the supplied value is not a legal boolean.
-
normalizeDecimal
Normalizes a decimal to its canonical representation. For example: 120 becomes 120.0, +.3 becomes 0.3, 00012.45000 becomes 12.45 and -.0 becomes 0.0.- Parameters:
decimal
- The decimal to normalize.- Returns:
- The canonical representation of decimal.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal decimal.
-
normalizeInteger
Normalizes an integer to its canonical representation. For example: +120 becomes 120 and 00012 becomes 12.- Parameters:
value
- The value to normalize.- Returns:
- The canonical representation of value.
- Throws:
IllegalArgumentException
- If the supplied value is not a legal integer.
-
normalizeNegativeInteger
Normalizes an xsd:negativeInteger. -
normalizeNonPositiveInteger
Normalizes an xsd:nonPositiveInteger. -
normalizeNonNegativeInteger
Normalizes an xsd:nonNegativeInteger. -
normalizePositiveInteger
Normalizes an xsd:positiveInteger. -
normalizeLong
Normalizes an xsd:long. -
normalizeInt
Normalizes an xsd:int. -
normalizeShort
Normalizes an xsd:short. -
normalizeByte
Normalizes an xsd:byte. -
normalizeUnsignedLong
Normalizes an xsd:unsignedLong. -
normalizeUnsignedInt
Normalizes an xsd:unsignedInt. -
normalizeUnsignedShort
Normalizes an xsd:unsignedShort. -
normalizeUnsignedByte
Normalizes an xsd:unsignedByte. -
normalizeFloat
Normalizes a float to its canonical representation.- Parameters:
value
- The value to normalize.- Returns:
- The canonical representation of value.
- Throws:
IllegalArgumentException
- If the supplied value is not a legal float.
-
normalizeDouble
Normalizes a double to its canonical representation.- Parameters:
value
- The value to normalize.- Returns:
- The canonical representation of value.
- Throws:
IllegalArgumentException
- If the supplied value is not a legal double.
-
normalizeFPNumber
Normalizes a floating point number to its canonical representation.- Parameters:
value
- The value to normalize.- Returns:
- The canonical representation of value.
- Throws:
IllegalArgumentException
- If the supplied value is not a legal floating point number.
-
normalizeDateTime
Normalizes an xsd:dateTime.- Parameters:
value
- The value to normalize.- Returns:
- The normalized value.
- Throws:
IllegalArgumentException
- If the supplied value is not a legal xsd:dateTime value.
-
collapseWhiteSpace
Replaces all contiguous sequences of #x9 (tab), #xA (line feed) and #xD (carriage return) with a single #x20 (space) character, and removes any leading and trailing whitespace characters, as specified for whiteSpace facet collapse.- Parameters:
s
-- Returns:
- new string
-
compare
-
compareDecimals
Compares two decimals to eachother.- Parameters:
dec1
-dec2
-- Returns:
- A negative number if dec1 is smaller than dec2, 0 if they are equal, or positive (>0) if dec1 is larger than dec2.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal decimal.
-
compareCanonicalDecimals
Compares two canonical decimals to each other.- Parameters:
dec1
-dec2
-- Returns:
- A negative number if dec1 is smaller than dec2, 0 if they are equal, or positive (>0) if dec1 is larger than dec2. The result is undefined when one or both of the arguments is not a canonical decimal.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal decimal.
-
compareIntegers
Compares two integers to each other.- Parameters:
int1
-int2
-- Returns:
- A negative number if int1 is smaller than int2, 0 if they are equal, or positive (>0) if int1 is larger than int2.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal integer.
-
compareCanonicalIntegers
Compares two canonical integers to each other.- Parameters:
int1
-int2
-- Returns:
- A negative number if int1 is smaller than int2, 0 if they are equal, or positive (>0) if int1 is larger than int2. The result is undefined when one or both of the arguments is not a canonical integer.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal integer.
-
compareNegativeIntegers
-
compareNonPositiveIntegers
-
compareNonNegativeIntegers
-
comparePositiveIntegers
-
compareLongs
-
compareInts
-
compareShorts
-
compareBytes
-
compareUnsignedLongs
-
compareUnsignedInts
-
compareUnsignedShorts
-
compareUnsignedBytes
-
compareFloats
Compares two floats to each other.- Parameters:
float1
-float2
-- Returns:
- A negative number if float1 is smaller than float2, 0 if they are equal, or positive (>0) if float1 is larger than float2.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal float or if NaN is compared to a float other than NaN.
-
compareCanonicalFloats
Compares two canonical floats to each other.- Parameters:
float1
-float2
-- Returns:
- A negative number if float1 is smaller than float2, 0 if they are equal, or positive (>0) if float1 is larger than float2. The result is undefined when one or both of the arguments is not a canonical float.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal float or if NaN is compared to a float other than NaN.
-
compareDoubles
Compares two doubles to each other.- Parameters:
double1
-double2
-- Returns:
- A negative number if double1 is smaller than double2, 0 if they are equal, or positive (>0) if double1 is larger than double2.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal double or if NaN is compared to a double other than NaN.
-
compareCanonicalDoubles
Compares two canonical doubles to eachother.- Parameters:
double1
-double2
-- Returns:
- A negative number if double1 is smaller than double2, 0 if they are equal, or positive (>0) if double1 is larger than double2. The result is undefined when one or both of the arguments is not a canonical double.
- Throws:
IllegalArgumentException
- If one of the supplied strings is not a legal double or if NaN is compared to a double other than NaN.
-
compareFPNumbers
Compares two floating point numbers to eachother.- Parameters:
fp1
-fp2
-- Returns:
- A negative number if float1 is smaller than float2, 0 if they are equal, or positive (>0) if float1 is larger than float2. @throws IllegalArgumentException If one of the supplied strings is not a legal floating point number or if NaN is compared to a floating point number other than NaN.
-
compareCanonicalFPNumbers
Compares two canonical floating point numbers to each other.- Parameters:
float1
-float2
-- Returns:
- A negative number if float1 is smaller than float2, 0 if they are equal, or positive (>0) if float1 is larger than float2. The result is undefined when one or both of the arguments is not a canonical floating point number. @throws IllegalArgumentException If one of the supplied strings is not a legal floating point number or if NaN is compared to a floating point number other than NaN.
-
compareDateTime
Compares two dateTime objects. Important: The comparison only works if both values have, or both values don't have specified a valid value for the timezone.- Parameters:
value1
- An xsd:dateTime value.value2
- An xsd:dateTime value.- Returns:
- -1 if value1 is before value2 (i.e. if the dateTime object represented
by value1 is before the dateTime object represented by value2), 0 if both are equal and
1 if value2 is before value1
.
-
parseBoolean
Parses the supplied xsd:boolean string and returns its value.- Parameters:
s
- A string representation of an xsd:boolean value.- Returns:
- The boolean value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:boolean value.
-
parseByte
Parses the supplied xsd:byte string and returns its value.- Parameters:
s
- A string representation of an xsd:byte value.- Returns:
- The byte value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:byte value.
-
parseShort
Parses the supplied xsd:short string and returns its value.- Parameters:
s
- A string representation of an xsd:short value.- Returns:
- The short value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:short value.
-
parseInt
Parses the supplied xsd:int strings and returns its value.- Parameters:
s
- A string representation of an xsd:int value.- Returns:
- The int value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:int value.
-
parseLong
Parses the supplied xsd:long string and returns its value.- Parameters:
s
- A string representation of an xsd:long value.- Returns:
- The long value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:long value.
-
parseFloat
Parses the supplied xsd:float string and returns its value.- Parameters:
s
- A string representation of an xsd:float value.- Returns:
- The float value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:float value.
-
parseDouble
Parses the supplied xsd:double string and returns its value.- Parameters:
s
- A string representation of an xsd:double value.- Returns:
- The double value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:double value.
-
parseInteger
Parses the supplied xsd:integer string and returns its value.- Parameters:
s
- A string representation of an xsd:integer value.- Returns:
- The integer value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:integer value.
-
parseDecimal
Parses the supplied decimal/floating point string and returns its value.- Parameters:
s
- A string representation of an xsd:decimal or xsd:double value.- Returns:
- The decimal/floating point value represented by the supplied string argument.
- Throws:
NumberFormatException
- If the supplied string is not a valid xsd:decimal or xsd:double value.
-
parseCalendar
Parses the supplied calendar value string and returns its value.- Parameters:
s
- A string representation of an xsd:dateTime, xsd:time, xsd:date, xsd:gYearMonth, xsd:gMonthDay, xsd:gYear, xsd:gMonth or xsd:gDay value.- Returns:
- The calendar value represented by the supplied string argument.
- Throws:
IllegalArgumentException
- If the supplied string is not a valid calendar value.
-
parseDuration
Parses the supplied xsd:duration value string and returns its value.- Parameters:
s
- A string representation of an xsd:duration value.- Returns:
- The
Duration
value represented by the supplied string argument. - Throws:
IllegalArgumentException
- If the supplied string is not a valid xsd:duration value.UnsupportedOperationException
- If implementation cannot support requested values. The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.
-
qnameToURI
Maps a datatype QName from the javax.xml.namespace package to an XML Schema 1.0 URI for the corresponding datatype. This method recognizes the XML Schema qname mentioned inDatatypeConstants
.Note that Java 8 / 11 do not have constants for XML Schema 1.1 datatypes like xsd:dateTimeStamp.
- Parameters:
qname
- One of the XML Schema qnames fromDatatypeConstants
.- Returns:
- A URI for the specified datatype.
- Throws:
IllegalArgumentException
- If the supplied qname was not recognized by this method.- See Also:
-
qnameToCoreDatatype
-
toString
-