XmlReader.ReadElementContentAs Method (Type, IXmlNamespaceResolver, String, String)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type.
Assembly: System.Xml (in System.Xml.dll)
'Declaration Public Overridable Function ReadElementContentAs ( _ returnType As Type, _ namespaceResolver As IXmlNamespaceResolver, _ localName As String, _ namespaceURI As String _ ) As Object
Parameters
- returnType
- Type: System.Type
The type of the value to be returned.
Note With the release of the .NET Framework 3.5, the value of the returnType parameter can now be the DateTimeOffset type.
- namespaceResolver
- Type: System.Xml.IXmlNamespaceResolver
An IXmlNamespaceResolver object that is used to resolve any namespace prefixes related to type conversion.
- localName
- Type: System.String
The local name of the element.
- namespaceURI
- Type: System.String
The namespace URI of the element.
| Exception | Condition |
|---|---|
| InvalidOperationException | The XmlReader is not positioned on an element. |
| XmlException | The current element contains child elements. -or- The element content cannot be converted to the requested type. |
| ArgumentNullException | The method is called with Nothing arguments. |
| ArgumentException | The specified local name and namespace URI do not match that of the current element being read. |
| OverflowException | Read Decimal.MaxValue. |