Saxon.Api
Class XdmAtomicValue
-
public class XdmAtomicValue
- extends XdmItem
The class XdmAtomicValue
represents an item in an XDM sequence
that is an atomic value. The value may belong to any of the 19 primitive types
defined in XML Schema, or to a type derived from these primitive types, or to
the XDM-specific type xs:untypedAtomic
.
Note that there is no guarantee that every XdmValue
comprising a single
atomic value will be an instance of this class. To force this, use the Simplify
property of the XdmValue
.
Constructor Summary |
|
---|---|
XdmAtomicValue (string str)
Construct an atomic value of type |
|
XdmAtomicValue (long i)
Construct an atomic value of type |
|
XdmAtomicValue (int i)
Construct an atomic value of type |
|
XdmAtomicValue (Byte i)
Construct an atomic value of type |
|
XdmAtomicValue (decimal d)
Construct an atomic value of type |
|
XdmAtomicValue (float f)
Construct an atomic value of type |
|
XdmAtomicValue (DateTime dt)
Construct an atomic value of type |
|
XdmAtomicValue (DateTimeOffset offset)
Construct an atomic value of type |
|
XdmAtomicValue (double d)
Construct an atomic value of type |
|
XdmAtomicValue (bool b)
Construct an atomic value of type |
|
XdmAtomicValue (Uri u)
Construct an atomic value of type |
|
XdmAtomicValue (QName q)
Construct an atomic value of type |
|
XdmAtomicValue (string lexicalForm, XdmAtomicType type) Construct an atomic value of a given type |
|
XdmAtomicValue (string lexicalForm, QName type, Processor processor) Construct an atomic value of a given built-in or user-defined type |
Property Summary |
|
---|---|
object | Value Get the value as a CLI object of the nearest equivalent type. |
Method Summary |
|
---|---|
bool | Equals(object other) Compare two atomic values for equality |
bool | GetBooleanValue() Get the value converted to a boolean using the XPath casting rules. |
decimal | GetDecimalValue() Get the value converted to a decimal using the XPath casting rules. |
double | GetDoubleValue() Get the value converted to a double using the XPath casting rules. |
int | GetHashCode() Get a hash code to support equality comparison |
long | GetLongValue() Get the value converted to a long using the XPath casting rules. |
QName | GetPrimitiveTypeName() Get the name of the primitive type of the value |
QName | GetTypeName() Get the name of the value's XDM type |
QName | GetTypeName(Processor processor) Get the name of the value's XDM type |
bool | IsAtomic() Determine whether the item is an atomic value |
static XdmAtomicValue | MakeAtomicValue(object value) Create an atomic value of a type appropriate to the supplied value. |
string | ToString() Convert the atomic value to a string |
Constructor Detail
XdmAtomicValue
Construct an atomic value of type xs:string
Parameters:
str
- The string valueXdmAtomicValue
Construct an atomic value of type xs:integer
from a supplied long
Parameters:
i
- The integer valueXdmAtomicValue
Construct an atomic value of type xs:integer
from a supplied long
Parameters:
i
- The integer valueXdmAtomicValue
Construct an atomic value of type xs:integer
from a supplied byte
Parameters:
i
- The integer value, in the range -128 to +127XdmAtomicValue
Construct an atomic value of type xs:decimal
Parameters:
d
- The decimal valueXdmAtomicValue
Construct an atomic value of type xs:float
Parameters:
f
- The float valueXdmAtomicValue
Construct an atomic value of type xs:dateTime
from a .NET DateTime object
Here we probe the object for timezone offset information to create the resulting value.
Parameters:
dt
- The DateTime object valueXdmAtomicValue
Construct an atomic value of type xs:dateTime
with a specific timezone offset from a DateTimeOffset object.
Parameters:
offset
- The DateTimeOffset valueXdmAtomicValue
Construct an atomic value of type xs:double
Parameters:
d
- The double valueXdmAtomicValue
Construct an atomic value of type xs:boolean
Parameters:
b
- The boolean valueXdmAtomicValue
Construct an atomic value of type xs:anyURI
Parameters:
u
- The uri valueXdmAtomicValue
Construct an atomic value of type xs:QName
Parameters:
q
- The QName valueXdmAtomicValue
Construct an atomic value of a given type
Parameters:
lexicalForm
- The string representation of the value (any value that is acceptable
in the lexical space, as defined by XML Schema Part 2). Whitespace normalization as
defined by
the target type will be applied to the value.type
- The type given as an XdmAtomicType
XdmAtomicValue
Construct an atomic value of a given built-in or user-defined type
Parameters:
lexicalForm
- The string representation of the value (any value that is acceptable
in the lexical space, as defined by XML Schema Part 2). Whitespace normalization as
defined by
the target type will be applied to the value.type
- The QName giving the name of the target type. This must be an atomic
type, and it must not be a type that is namespace-sensitive (QName, NOTATION, or types
derived
from these). If the type is a user-defined type then its definition must be present
in the schema cache maintained by the SchemaManager
.processor
- The Processor
object. This is needed for looking up user-defined
types, and also because some conversions are context-sensitive, for example they depend
on the
implicit timezone or the choice of XML 1.0 versus XML 1.1 for validating names.Throws:
Property Detail
Value
Get the value as a CLI object of the nearest equivalent type.
The return type is as follows:
-
xs:string
- String -
xs:integer
- Long -
xs:decimal
- Decimal -
xs:double
- Double -
xs:float
- Float -
xs:boolean
- Bool -
xs:QName
- QName -
xs:anyURI
- Uri -
xs:untypedAtomic
- String - wrapped external object - the original external object
- Other types - currently String, but this may change in the future
Returns:
Method Detail
GetBooleanValue
Get the value converted to a boolean using the XPath casting rules.
Returns:
GetDecimalValue
Get the value converted to a decimal using the XPath casting rules.
Returns:
GetDoubleValue
Get the value converted to a double using the XPath casting rules.
If the value is a string, the XSD 1.1 rules are used, which means that the string "+INF" is recognised.
Returns:
GetHashCode
Get a hash code to support equality comparison
Returns:
GetLongValue
Get the value converted to a long using the XPath casting rules.
Returns:
GetPrimitiveTypeName
Get the name of the primitive type of the value
Returns:
xs:untypedAtomic
. For the purposes of this method, xs:integer
is considered
to be a primitive type.
GetTypeName
Get the name of the value's XDM type
Returns:
GetTypeName
Get the name of the value's XDM type
Parameters:
processor
- The Processor
object.
This parameter is no longer used, but is accepted for backwards compatibility.Returns:
IsAtomic
Determine whether the item is an atomic value
Returns:
MakeAtomicValue
Create an atomic value of a type appropriate to the supplied value.
The supplied value must be one of the following:
- An instance of the Saxon Java class
net.sf.saxon.value.AtomicValue
- A
Boolean
- returns an instance ofxs:boolean
- A (signed)
int
,long
,short
, orbyte
- returns an instance ofxs:integer
- A
Char
- TODO ??????? - A
String
- returns an instance ofxs:string
- A
Double
- returns an instance ofxs:double
- A
Float
- returns an instance ofxs:float
- A
decimal
- returns an instance ofxs:decimal
- A
URI
- returns an instance ofxs:anyURI
- A
QName
- returns an instance ofxs:QName
Parameters:
value
- The value to be converted.Returns:
ToString
Convert the atomic value to a string
Returns:
Compare two atomic values for equality
Parameters:
other
- The object to be comparedReturns:
op:is-same-key()
comparison used for comparing key values in maps.