SecurityElement.Escape(String) 메서드

정의

문자열에 있는 잘못된 XML 문자를 해당하는 올바른 XML로 바꿉니다.

public:
 static System::String ^ Escape(System::String ^ str);
public static string? Escape (string? str);
public static string Escape (string str);
static member Escape : string -> string
Public Shared Function Escape (str As String) As String

매개 변수

str
String

이스케이프할 잘못된 문자가 포함된 문자열입니다.

반환

String

잘못된 문자가 있었으나 바뀐 입력 문자열입니다.

예제

다음 코드에서는 메서드를 사용하여 문자열의 잘못된 XML 문자를 유효한 XML 문자로 바꾸는 방법을 보여 Escape 있습니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 SecurityElement 클래스입니다.

tagText = SecurityElement::Escape( tagText );
tagText = SecurityElement.Escape(tagText);
    tagText = SecurityElement.Escape(tagText)
End If

설명

에서 문자열을 사용하기 전에 이 메서드를 사용하여 문자열의 잘못된 문자를 바꿀 수 SecurityElement 있습니다. 이스케이프되지 않고 에 잘못된 문자를 사용하면 SecurityElement ArgumentException 이 throw됩니다.

다음 표에서는 잘못된 XML 문자와 이스케이프된 해당 문자를 보여 제공합니다.

잘못된 XML 문자 으로 대체
< &lt;
> &gt;
" &quot;
' &apos;
& &amp;

적용 대상