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 (net.sf.saxon.value.AtomicValue atomicValue)
Construct an XdmNode as a wrapper around an instance of the internal class |
|
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 |
Property Summary |
|
---|---|
QName | PrimitiveTypeName Get the name of the primitive type of the value |
QName | TypeName Get the name of the value's XDM type |
object | Value Get the value as a CLI object of the nearest equivalent type. |
Method Summary |
|
---|---|
bool | AsBoolean () Get the value converted to a boolean using the XPath casting rules. |
decimal | AsDecimal () Get the value converted to a decimal using the XPath casting rules. |
double | AsDouble () Get the value converted to a double using the XPath casting rules. |
long | AsLong () Get the value converted to a long using the XPath casting rules. |
QName | AsQName () Get the value converted to a QName. The value must be of type xs:QName or xs:NOTATION. |
bool | Equals (object other) Compare two atomic values for equality |
int | GetHashCode () Get a hash code to support equality comparison |
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 XdmNode as a wrapper around an instance of the internal class Saxon.Hej.value.AtomicValue
Applications using the class Saxon.Hej.value.AtomicValue
should be aware that it is subject to occasional
changes from one release to the next. For documentation on this class, see the Saxon-EE
Javadoc documentation
for the very similar class net.sf.saxon.value.AtomicValue.
Parameters:
atomicValue
- The object to be wrappedXdmAtomicValue
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.
The timezone offset in the result is taken from the system clock: more specifically,
it is the value of TimeZoneInfo.Local.GetUtcOffset(DateTime.Now)
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
Property Detail
PrimitiveTypeName
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.
TypeName
Get the name of the value's XDM type
Returns:
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
AsBoolean
throws
InvalidCastException
AsDecimal
throws
InvalidCastException
Get the value converted to a decimal using the XPath casting rules.
Returns:
Throws:
AsDouble
throws
InvalidCastException
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:
Throws:
AsLong
throws
InvalidCastException
Get the value converted to a long using the XPath casting rules.
Returns:
Throws:
AsQName
throws
InvalidCastException
Get the value converted to a QName. The value must be of type xs:QName or xs:NOTATION.
Returns:
Throws:
Equals
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.GetHashCode
Get a hash code to support equality comparison
Returns:
IsAtomic
Determine whether the item is an atomic value
Returns:
MakeAtomicValue
throws
ArgumentException
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
Saxon.Hej.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:
Throws:
ToString
Convert the atomic value to a string
Returns:
StringValue
property.
Get the value converted to a boolean using the XPath casting rules.
Returns:
Throws: