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.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( L"Parse succeeded on the string \"{0}\".", testString ); // Print the string representation of the object. Console::WriteLine( L"The normalized value of this string is \"{0}\".", normalized ); // Print the XSD type of the object. Console::WriteLine( L"The XSD type of the SoapNormalizedString object is {0}.", normalized->GetXsdType() ); // Print the value of the SoapNormalizedString object. Console::WriteLine( L"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( L"Parse failed on the string \"{0}\".", testString ); Console::WriteLine( e->Message ); } } int main() { // Create strings to test the Parse method. String^ stringWithSpaces = L"one two"; String^ stringWithSpacesAndTabs = L"one two\t"; String^ stringWithSpacesAndLineFeed = L"one two\n"; String^ stringWithSpacesAndCarriageReturn = L"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( L"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.
Community Additions
Show: