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 StringReplaces 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 intstatic intcompareBytes(String int1, String int2) static intcompareCanonicalDecimals(String dec1, String dec2) Compares two canonical decimals to each other.static intcompareCanonicalDoubles(String double1, String double2) Compares two canonical doubles to eachother.static intcompareCanonicalFloats(String float1, String float2) Compares two canonical floats to each other.static intcompareCanonicalFPNumbers(String float1, String float2) Compares two canonical floating point numbers to each other.static intcompareCanonicalIntegers(String int1, String int2) Compares two canonical integers to each other.static intcompareDateTime(String value1, String value2) Compares two dateTime objects.static intcompareDecimals(String dec1, String dec2) Compares two decimals to eachother.static intcompareDoubles(String double1, String double2) Compares two doubles to each other.static intcompareFloats(String float1, String float2) Compares two floats to each other.static intcompareFPNumbers(String fp1, String fp2) Compares two floating point numbers to eachother.static intcompareIntegers(String int1, String int2) Compares two integers to each other.static intcompareInts(String int1, String int2) static intcompareLongs(String int1, String int2) static intcompareNegativeIntegers(String int1, String int2) static intcompareNonNegativeIntegers(String int1, String int2) static intcompareNonPositiveIntegers(String int1, String int2) static intcomparePositiveIntegers(String int1, String int2) static intcompareShorts(String int1, String int2) static intcompareUnsignedBytes(String int1, String int2) static intcompareUnsignedInts(String int1, String int2) static intcompareUnsignedLongs(String int1, String int2) static intcompareUnsignedShorts(String int1, String int2) static booleanisBuiltInDatatype(IRI datatype) Checks whether the supplied datatype is a built-in XML Schema datatype.static booleanisCalendarDatatype(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 booleanisDecimalDatatype(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 booleanisDerivedDatatype(IRI datatype) Checks whether the supplied datatype is a derived XML Schema datatype.static booleanisDurationDatatype(IRI datatype) Checks whether the supplied datatype is equal to xsd:duration, xsd:dayTimeDuration, xsd:yearMonthDuration.static booleanisFloatingPointDatatype(IRI datatype) Checks whether the supplied datatype is equal to xsd:float or xsd:double.static booleanisIntegerDatatype(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 booleanisNumericDatatype(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 booleanisOrderedDatatype(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 booleanisPrimitiveDatatype(IRI datatype) Checks whether the supplied datatype is a primitive XML Schema datatype.static booleanisValidAnyURI(String value) Determines if the supplied value is an Internationalized Resource Identifier Reference (IRI).static booleanisValidBoolean(String value) Verifies if the supplied lexical value is a valid boolean or not.static booleanisValidByte(String value) Verifies if the supplied lexical value is a valid byte or not.static booleanisValidDate(String value) Determines if the supplied value is a valid xsd:date string.static booleanisValidDateTime(String value) Verifies if the supplied lexical value is a valid date-time.static booleanisValidDateTimeStamp(String value) Verifies if the supplied lexical value is a valid date-timestamp.static booleanisValidDayTimeDuration(String value) Verifies if the supplied lexical value is a valid day-time duration ot not.static booleanisValidDecimal(String value) Verifies if the supplied lexical value is a valid decimal or not.static booleanisValidDouble(String value) Verifies if the supplied lexical value is a valid double or not.static booleanisValidDuration(String value) Verifies if the supplied lexical value is a valid duration.static booleanisValidFloat(String value) Verifies if the supplied lexical value is a valid float or not.static booleanisValidGDay(String value) Determines if the supplied value is a valid xsd:gDay string.static booleanisValidGMonth(String value) Determines if the supplied value is a valid xsd:gMonth string.static booleanisValidGMonthDay(String value) Determines if the supplied value is a valid xsd:gMonthDay string.static booleanisValidGYear(String value) Determines if the supplied value is a valid xsd:gYear string.static booleanisValidGYearMonth(String value) Determines if the supplied value is a valid xsd:gYearMonth string.static booleanisValidInt(String value) Verifies if the supplied lexical value is a valid integer or not.static booleanisValidInteger(String value) Verifies if the supplied lexical value is a valid integer or not.static booleanisValidLong(String value) Verifies if the supplied lexical value is a valid long or not.static booleanisValidNegativeInteger(String value) Verifies if the supplied lexical value is a valid negative integer or not.static booleanisValidNonNegativeInteger(String value) Verifies if the supplied lexical value is a valid non-negative integer or not.static booleanisValidNonPositiveInteger(String value) Verifies if the supplied lexical value is a valid non-positive integer or not.static booleanisValidPositiveInteger(String value) Verifies if the supplied lexical value is a valid positive integer or not.static booleanisValidQName(String value) Determines if the supplied value is a valid xsd:QName string.static booleanisValidShort(String value) Verifies if the supplied lexical value is a valid short or not.static booleanisValidTime(String value) Determines if the supplied value is a valid xsd:time string.static booleanisValidUnsignedByte(String value) Verifies if the supplied lexical value is a valid unsigned byte or not.static booleanisValidUnsignedInt(String value) Verifies if the supplied lexical value is a valid unsigned int.static booleanisValidUnsignedLong(String value) Verifies if the supplied lexical value is a valid unsigned long or not.static booleanisValidUnsignedShort(String value) Verifies if the supplied lexical value is a valid unsigned short or not.static booleanisValidValue(String value, CoreDatatype datatype) static booleanisValidValue(String value, CoreDatatype.XSD datatype) static booleanisValidValue(String value, IRI datatype) Verifies if the supplied lexical value is valid for the given datatype.static booleanisValidYearMonthDuration(String value) Verifies if the supplied lexical value is a valid year-month duration.static Stringnormalize(String value, CoreDatatype.XSD datatype) static StringNormalizes the supplied value according to the normalization rules for the supplied datatype.static StringnormalizeBoolean(String value) Normalizes a boolean value to its canonical representation.static StringnormalizeByte(String value) Normalizes an xsd:byte.static StringnormalizeDateTime(String value) Normalizes an xsd:dateTime.static StringnormalizeDecimal(String decimal) Normalizes a decimal to its canonical representation.static StringnormalizeDouble(String value) Normalizes a double to its canonical representation.static StringnormalizeFloat(String value) Normalizes a float to its canonical representation.static StringnormalizeFPNumber(String value) Normalizes a floating point number to its canonical representation.static StringnormalizeInt(String value) Normalizes an xsd:int.static StringnormalizeInteger(String value) Normalizes an integer to its canonical representation.static StringnormalizeLong(String value) Normalizes an xsd:long.static StringnormalizeNegativeInteger(String value) Normalizes an xsd:negativeInteger.static StringNormalizes an xsd:nonNegativeInteger.static StringNormalizes an xsd:nonPositiveInteger.static StringnormalizePositiveInteger(String value) Normalizes an xsd:positiveInteger.static StringnormalizeShort(String value) Normalizes an xsd:short.static StringnormalizeUnsignedByte(String value) Normalizes an xsd:unsignedByte.static StringnormalizeUnsignedInt(String value) Normalizes an xsd:unsignedInt.static StringnormalizeUnsignedLong(String value) Normalizes an xsd:unsignedLong.static StringnormalizeUnsignedShort(String value) Normalizes an xsd:unsignedShort.static booleanParses the supplied xsd:boolean string and returns its value.static byteParses the supplied xsd:byte string and returns its value.static XMLGregorianCalendarParses the supplied calendar value string and returns its value.static BigDecimalParses the supplied decimal/floating point string and returns its value.static doubleParses the supplied xsd:double string and returns its value.static DurationParses the supplied xsd:duration value string and returns its value.static floatparseFloat(String s) Parses the supplied xsd:float string and returns its value.static intParses the supplied xsd:int strings and returns its value.static BigIntegerParses the supplied xsd:integer string and returns its value.static longParses the supplied xsd:long string and returns its value.static shortparseShort(String s) Parses the supplied xsd:short string and returns its value.static CoreDatatype.XSDqnameToCoreDatatype(QName qname) static IRIqnameToURI(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
Durationvalue 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
-