DiscoveryDocument.CanRead Method
Returns a value indicating whether the passed XmlReader can be deserialized into a DiscoveryDocument.
[Visual Basic] Public Shared Function CanRead( _ ByVal xmlReader As XmlReader _ ) As Boolean [C#] public static bool CanRead( XmlReader xmlReader ); [C++] public: static bool CanRead( XmlReader* xmlReader ); [JScript] public static function CanRead( xmlReader : XmlReader ) : Boolean;
Parameters
- xmlReader
- The XmlReader that is tested whether it can be deserialized into a DiscoveryDocument.
Return Value
true if XmlReader can be deserialized into a DiscoveryDocument; otherwise, false.
Example
[Visual Basic, C#, C++] The following code example reads in the contents of a discovery document, if the CanRead property is true.
[Visual Basic] ' Check whether the given XmlTextReader is readable. If DiscoveryDocument.CanRead(myXmlTextReader) = True Then ' Read the given XmlTextReader. myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader) Else Console.WriteLine("The supplied file is not readable") End If [C#] // Check whether the given XmlTextReader is readable. if( DiscoveryDocument.CanRead( myXmlTextReader ) == true ) { // Read the given XmlTextReader. myDiscoveryDocument = DiscoveryDocument.Read( myXmlTextReader ); } else { Console.WriteLine( "The supplied file is not readable" ); } [C++] // Check whether the given XmlTextReader is readable. if (DiscoveryDocument::CanRead(myXmlTextReader) == true) // Read the given XmlTextReader. myDiscoveryDocument = DiscoveryDocument::Read(myXmlTextReader); else Console::WriteLine(S"The supplied file is not readable");
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
DiscoveryDocument Class | DiscoveryDocument Members | System.Web.Services.Discovery Namespace | XmlReader