ReadElementContentAs()

XmlReader::ReadElementContentAs(const TypeInfo&, SharedPtr<IXmlNamespaceResolver>) method

Reads the element content as the requested type.

virtual SharedPtr<Object> System::Xml::XmlReader::ReadElementContentAs(const TypeInfo &returnType, SharedPtr<IXmlNamespaceResolver> namespaceResolver)

Arguments

ParameterTypeDescription
returnTypeconst TypeInfo&The type of the value to be returned.
namespaceResolverSharedPtr<IXmlNamespaceResolver>An IXmlNamespaceResolver object that is used to resolve any namespace prefixes related to type conversion.

Return Value

The element content converted to the requested typed object.

Exceptions

ExceptionDescription
InvalidOperationExceptionThe XmlReader is not positioned on an element.
XmlExceptionThe current element contains child elements. The element content cannot be converted to the requested type.
ArgumentNullExceptionThe method is called with nullptr arguments.
OverflowExceptionRead Decimal::MaxValue.

XmlReader::ReadElementContentAs(const TypeInfo&, SharedPtr<IXmlNamespaceResolver>, String, String) method

Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type.

virtual SharedPtr<Object> System::Xml::XmlReader::ReadElementContentAs(const TypeInfo &returnType, SharedPtr<IXmlNamespaceResolver> namespaceResolver, String localName, String namespaceURI)

Arguments

ParameterTypeDescription
returnTypeconst TypeInfo&The type of the value to be returned.
namespaceResolverSharedPtr<IXmlNamespaceResolver>An IXmlNamespaceResolver object that is used to resolve any namespace prefixes related to type conversion.
localNameStringThe local name of the element.
namespaceURIStringThe namespace URI of the element.

Return Value

The element content converted to the requested typed object.

Exceptions

ExceptionDescription
InvalidOperationExceptionThe XmlReader is not positioned on an element.
XmlExceptionThe current element contains child elements. The element content cannot be converted to the requested type.
ArgumentNullExceptionThe method is called with nullptr arguments.
ArgumentExceptionThe specified local name and namespace URI do not match that of the current element being read.
OverflowExceptionRead Decimal::MaxValue.

See Also