ValueAs()

XPathItem::ValueAs(const TypeInfo&) method

Returns the item’s value as the specified type.

virtual SharedPtr<Object> System::Xml::XPath::XPathItem::ValueAs(const TypeInfo &returnType)

Arguments

ParameterTypeDescription
returnTypeconst TypeInfo&The type to return the item value as.

Return Value

The value of the item as the type requested.

Exceptions

ExceptionDescription
FormatExceptionThe item’s value is not in the correct format for the target type.
InvalidCastExceptionThe attempted cast is not valid.
OverflowExceptionThe attempted cast resulted in an overflow.

XPathItem::ValueAs(const TypeInfo&, SharedPtr<IXmlNamespaceResolver>) method

When overridden in a derived class, returns the item’s value as the type specified using the IXmlNamespaceResolver object specified to resolve namespace prefixes.

virtual SharedPtr<Object> System::Xml::XPath::XPathItem::ValueAs(const TypeInfo &returnType, SharedPtr<IXmlNamespaceResolver> nsResolver)=0

Arguments

ParameterTypeDescription
returnTypeconst TypeInfo&The type to return the item’s value as.
nsResolverSharedPtr<IXmlNamespaceResolver>The IXmlNamespaceResolver object used to resolve namespace prefixes.

Return Value

The value of the item as the type requested.

Exceptions

ExceptionDescription
FormatExceptionThe item’s value is not in the correct format for the target type.
InvalidCastExceptionThe attempted cast is not valid.
OverflowExceptionThe attempted cast resulted in an overflow.

See Also