SoapNormalizedString Class
Wraps an XML normalizedString type.
Assembly: mscorlib (in mscorlib.dll)
The following code example shows how to use the members in the SoapNormalizedString class to convert between a SoapNormalizedString object and an XSD normalizedString.
using System; using System.Runtime.Remoting.Metadata.W3cXsd2001; public class Demo { public static void TestParse(string testString) { try { // Parse the test string. SoapNormalizedString normalized = SoapNormalizedString.Parse(testString); // Report that the parse succeeded if no exception was thrown. Console.WriteLine( "Parse succeeded on the string \"{0}\".", testString); // Print the string representation of the object. Console.WriteLine( "The normalized value of this string is \"{0}\".", normalized.ToString()); // Print the XSD type of the object. Console.WriteLine( "The XSD type of the SoapNormalizedString " + "object is {0}.", normalized.GetXsdType()); // Print the value of the SoapNormalizedString object. Console.WriteLine( "The value of the SoapNormalizedString " + "object is \"{0}\".", normalized.Value); } catch(System.Runtime.Remoting.RemotingException e) { // Report the details of the exception that was thrown. Console.WriteLine( "Parse failed on the string \"{0}\".", testString); Console.WriteLine(e.Message); } } public static void Main(string[] args) { // Create strings to test the Parse method. string stringWithSpaces = "one two"; string stringWithSpacesAndTabs = "one two\t"; string stringWithSpacesAndLineFeed = "one two\n"; string stringWithSpacesAndCarriageReturn = "one two\r"; // Test the Parse method with each string. TestParse(stringWithSpaces); TestParse(stringWithSpacesAndTabs); TestParse(stringWithSpacesAndLineFeed); TestParse(stringWithSpacesAndCarriageReturn); // Print the XSD type string of the SoapNormalizedString class. Console.WriteLine( "The XSD type of the SoapNormalizedString class " + "is {0}.", SoapNormalizedString.XsdType); } }
#using <mscorlib.dll>
#using <System.Runtime.Remoting.dll>
using namespace System;
using namespace System::Runtime::Remoting::Metadata::W3cXsd2001;
static void TestParse(String* testString)
{
try
{
// Parse the test string.
SoapNormalizedString* normalized =
SoapNormalizedString::Parse(testString);
// Report that the parse succeeded if no exception was thrown.
Console::WriteLine(
S"Parse succeeded on the string \"{0}\".",
testString);
// Print the string representation of the object.
Console::WriteLine(
S"The normalized value of this string is \"{0}\".",
normalized);
// Print the XSD type of the object.
Console::WriteLine(
S"The XSD type of the SoapNormalizedString object is {0}.",
normalized->GetXsdType());
// Print the value of the SoapNormalizedString object.
Console::WriteLine(
S"The value of the SoapNormalizedString object is \"{0}\".",
normalized->Value);
}
catch(System::Runtime::Remoting::RemotingException* e)
{
// Report the details of the exception that was thrown.
Console::WriteLine(
S"Parse failed on the string \"{0}\".",
testString);
Console::WriteLine(e->Message);
}
}
int main()
{
// Create strings to test the Parse method.
String* stringWithSpaces = S"one two";
String* stringWithSpacesAndTabs = S"one two\t";
String* stringWithSpacesAndLineFeed = S"one two\n";
String* stringWithSpacesAndCarriageReturn = S"one two\r";
// Test the Parse method with each string.
TestParse(stringWithSpaces);
TestParse(stringWithSpacesAndTabs);
TestParse(stringWithSpacesAndLineFeed);
TestParse(stringWithSpacesAndCarriageReturn);
// Print the XSD type string of the SoapNormalizedString class.
Console::WriteLine(
S"The XSD type of the SoapNormalizedString class is {0}.",
SoapNormalizedString::XsdType);
}
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.