SecurityElement 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示用于对安全对象进行编码的 XML 对象模型。 此类不能被继承。
public ref class SecurityElement sealed
public sealed class SecurityElement
[System.Serializable]
public sealed class SecurityElement
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SecurityElement
type SecurityElement = class
[<System.Serializable>]
type SecurityElement = class
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type SecurityElement = class
Public NotInheritable Class SecurityElement
- 继承
-
SecurityElement
- 属性
示例
以下示例演示如何使用 类的成员 SecurityElement 。
using namespace System;
using namespace System::Security;
using namespace System::Collections;
ref class SecurityElementMembers
{
public:
[STAThread]
int TestSecurityElementMembers()
{
SecurityElement^ xmlRootElement = gcnew SecurityElement( L"RootTag",L"XML security tree" );
AddAttribute( xmlRootElement, L"creationdate", DateTime::Now.ToString() );
AddChildElement( xmlRootElement, L"destroytime", DateTime::Now.AddSeconds( 1.0 ).ToString() );
SecurityElement^ windowsRoleElement = gcnew SecurityElement( L"WindowsMembership.WindowsRole" );
windowsRoleElement->AddAttribute( L"version", L"1.00" );
// Add a child element and a creationdate attribute.
AddChildElement( windowsRoleElement, L"BabyElement", L"This is a child element" );
AddAttribute( windowsRoleElement, L"creationdate", DateTime::Now.ToString() );
xmlRootElement->AddChild( windowsRoleElement );
CompareAttributes( xmlRootElement, L"creationdate" );
ConvertToHashTable( xmlRootElement );
DisplaySummary( xmlRootElement );
// Determine if the security element is too old to keep.
xmlRootElement = DestroyTree( xmlRootElement );
if ( xmlRootElement != nullptr )
{
String^ elementInXml = xmlRootElement->ToString();
Console::WriteLine( elementInXml );
}
Console::WriteLine( L"This sample completed successfully; "
L"press Enter to exit." );
Console::ReadLine();
return 1;
}
private:
// Add an attribute to the specified security element.
static SecurityElement^ AddAttribute( SecurityElement^ xmlElement, String^ attributeName, String^ attributeValue )
{
if ( xmlElement != nullptr )
{
// Verify that the attribute name and value are valid XML formats.
if ( SecurityElement::IsValidAttributeName( attributeName ) &&
SecurityElement::IsValidAttributeValue( attributeValue ) )
{
// Add the attribute to the security element.
xmlElement->AddAttribute( attributeName, attributeValue );
}
}
return xmlElement;
}
// Add a child element to the specified security element.
static SecurityElement^ AddChildElement( SecurityElement^ parentElement, String^ tagName, String^ tagText )
{
if ( parentElement != nullptr )
{
// Ensure that the tag text is in valid XML format.
if ( !SecurityElement::IsValidText( tagText ) )
{
// Replace invalid text with valid XML text
// to enforce proper XML formatting.
tagText = SecurityElement::Escape( tagText );
}
// Determine whether the tag is in valid XML format.
if ( SecurityElement::IsValidTag( tagName ) )
{
SecurityElement^ childElement;
childElement = parentElement->SearchForChildByTag( tagName );
if ( childElement != nullptr )
{
String^ elementText;
elementText = parentElement->SearchForTextOfTag( tagName );
if ( !elementText->Equals( tagText ) )
{
// Add child element to the parent security element.
parentElement->AddChild( gcnew SecurityElement( tagName,tagText ) );
}
}
else
{
// Add child element to the parent security element.
parentElement->AddChild( gcnew SecurityElement( tagName,tagText ) );
}
}
}
return parentElement;
}
// Create and display a summary sentence
// about the specified security element.
static void DisplaySummary( SecurityElement^ xmlElement )
{
// Retrieve tag name for the security element.
String^ xmlTreeName = xmlElement->Tag->ToString();
// Retrieve tag text for the security element.
String^ xmlTreeDescription = xmlElement->Text;
// Retrieve value of the creationdate attribute.
String^ xmlCreationDate = xmlElement->Attribute(L"creationdate");
// Retrieve the number of children under the security element.
String^ childrenCount = xmlElement->Children->Count.ToString();
String^ outputMessage = String::Format( L"The security XML tree named {0}", xmlTreeName );
outputMessage = String::Concat( outputMessage, String::Format( L"({0})", xmlTreeDescription ) );
outputMessage = String::Concat( outputMessage, String::Format( L" was created on {0} and ", xmlCreationDate ) );
outputMessage = String::Concat( outputMessage, String::Format( L"contains {0} child elements.", childrenCount ) );
Console::WriteLine( outputMessage );
}
// Compare the first two occurrences of an attribute
// in the specified security element.
static void CompareAttributes( SecurityElement^ xmlElement, String^ attributeName )
{
// Create a hash table containing the security element's attributes.
Hashtable^ attributeKeys = xmlElement->Attributes;
String^ attributeValue = attributeKeys[ attributeName ]->ToString();
IEnumerator^ myEnum = xmlElement->Children->GetEnumerator();
while ( myEnum->MoveNext() )
{
SecurityElement^ xmlChild = safe_cast<SecurityElement^>(myEnum->Current);
if ( attributeValue->Equals( xmlChild->Attribute(attributeName) ) )
{
// The security elements were created at the exact same time.
}
}
}
// Convert the contents of the specified security element
// to hash codes stored in a hash table.
static void ConvertToHashTable( SecurityElement^ xmlElement )
{
// Create a hash table to hold hash codes of the security elements.
Hashtable^ xmlAsHash = gcnew Hashtable;
int rootIndex = xmlElement->GetHashCode();
xmlAsHash->Add( rootIndex, L"root" );
int parentNum = 0;
IEnumerator^ myEnum1 = xmlElement->Children->GetEnumerator();
while ( myEnum1->MoveNext() )
{
SecurityElement^ xmlParent = safe_cast<SecurityElement^>(myEnum1->Current);
parentNum++;
xmlAsHash->Add( xmlParent->GetHashCode(), String::Format( L"parent{0}", parentNum ) );
if ( (xmlParent->Children != nullptr) && (xmlParent->Children->Count > 0) )
{
int childNum = 0;
IEnumerator^ myEnum2 = xmlParent->Children->GetEnumerator();
while ( myEnum2->MoveNext() )
{
SecurityElement^ xmlChild = safe_cast<SecurityElement^>(myEnum2->Current);
childNum++;
xmlAsHash->Add( xmlChild->GetHashCode(), String::Format( L"child{0}", childNum ) );
}
}
}
}
// Delete the specified security element if the current time is past
// the time stored in the destroytime tag.
static SecurityElement^ DestroyTree( SecurityElement^ xmlElement )
{
SecurityElement^ localXmlElement = xmlElement;
SecurityElement^ destroyElement = localXmlElement->SearchForChildByTag( L"destroytime" );
// Verify that a destroytime tag exists.
if ( localXmlElement->SearchForChildByTag( L"destroytime" ) != nullptr )
{
// Retrieve the destroytime text to get the time
// the tree can be destroyed.
String^ storedDestroyTime = localXmlElement->SearchForTextOfTag( L"destroytime" );
DateTime destroyTime = DateTime::Parse( storedDestroyTime );
if ( DateTime::Now > destroyTime )
{
localXmlElement = nullptr;
Console::WriteLine( L"The XML security tree has been deleted." );
}
}
// Verify that xmlElement is of type SecurityElement.
if ( xmlElement->GetType()->Equals( System::Security::SecurityElement::typeid ) )
{
// Determine whether the localXmlElement object
// differs from xmlElement.
if ( xmlElement->Equals( localXmlElement ) )
{
// Verify that the tags, attributes and children of the
// two security elements are identical.
if ( xmlElement->Equal( localXmlElement ) )
{
// Return the original security element.
return xmlElement;
}
}
}
// Return the modified security element.
return localXmlElement;
}
};
int main()
{
SecurityElementMembers^ sem = gcnew SecurityElementMembers;
sem->TestSecurityElementMembers();
}
//
// This sample produces the following output:
//
// The security XML tree named RootTag(XML security tree)
// was created on 2/23/2004 1:23:00 PM and contains 2 child elements.
//<RootTag creationdate="2/23/2004 1:23:00 PM">XML security tree
// <destroytime>2/23/2004 1:23:01 PM</destroytime>
// <WindowsMembership.WindowsRole version="1.00"
// creationdate="2/23/2004 1:23:00 PM">
// <BabyElement>This is a child element.</BabyElement>
//
//This sample completed successfully; press Exit to continue.
using System;
using System.Security;
using System.Collections;
class SecurityElementMembers
{
[STAThread]
static void Main(string[] args)
{
SecurityElement xmlRootElement =
new SecurityElement("RootTag", "XML security tree");
AddAttribute(xmlRootElement,"creationdate",DateTime.Now.ToString());
AddChildElement(xmlRootElement,"destroytime",
DateTime.Now.AddSeconds(1.0).ToString());
SecurityElement windowsRoleElement =
new SecurityElement("WindowsMembership.WindowsRole");
windowsRoleElement.AddAttribute("version","1.00");
// Add a child element and a creationdate attribute.
AddChildElement(windowsRoleElement,"BabyElement",
"This is a child element");
AddAttribute(windowsRoleElement,"creationdate",
DateTime.Now.ToString());
xmlRootElement.AddChild(windowsRoleElement);
CompareAttributes(xmlRootElement, "creationdate");
ConvertToHashTable(xmlRootElement);
DisplaySummary(xmlRootElement);
// Determine if the security element is too old to keep.
xmlRootElement = DestroyTree(xmlRootElement);
if (xmlRootElement != null)
{
string elementInXml = xmlRootElement.ToString();
Console.WriteLine(elementInXml);
}
Console.WriteLine("This sample completed successfully; " +
"press Enter to exit.");
Console.ReadLine();
}
// Add an attribute to the specified security element.
private static SecurityElement AddAttribute(
SecurityElement xmlElement,
string attributeName,
string attributeValue)
{
if (xmlElement != null)
{
// Verify that the attribute name and value are valid XML formats.
if (SecurityElement.IsValidAttributeName(attributeName) &&
SecurityElement.IsValidAttributeValue(attributeValue))
{
// Add the attribute to the security element.
xmlElement.AddAttribute(attributeName, attributeValue);
}
}
return xmlElement;
}
// Add a child element to the specified security element.
private static SecurityElement AddChildElement(
SecurityElement parentElement,
string tagName,
string tagText)
{
if (parentElement != null)
{
// Ensure that the tag text is in valid XML format.
if (!SecurityElement.IsValidText(tagText))
{
// Replace invalid text with valid XML text
// to enforce proper XML formatting.
tagText = SecurityElement.Escape(tagText);
}
// Determine whether the tag is in valid XML format.
if (SecurityElement.IsValidTag(tagName))
{
SecurityElement childElement;
childElement = parentElement.SearchForChildByTag(tagName);
if (childElement != null)
{
String elementText;
elementText = parentElement.SearchForTextOfTag(tagName);
if (!elementText.Equals(tagText))
{
// Add child element to the parent security element.
parentElement.AddChild(
new SecurityElement(tagName, tagText));
}
}
else
{
// Add child element to the parent security element.
parentElement.AddChild(
new SecurityElement(tagName, tagText));
}
}
}
return parentElement;
}
// Create and display a summary sentence
// about the specified security element.
private static void DisplaySummary(SecurityElement xmlElement)
{
// Retrieve tag name for the security element.
string xmlTreeName = xmlElement.Tag.ToString();
// Retrieve tag text for the security element.
string xmlTreeDescription = xmlElement.Text;
// Retrieve value of the creationdate attribute.
string xmlCreationDate = xmlElement.Attribute("creationdate");
// Retrieve the number of children under the security element.
string childrenCount = xmlElement.Children.Count.ToString();
string outputMessage = "The security XML tree named " + xmlTreeName;
outputMessage += "(" + xmlTreeDescription + ")";
outputMessage += " was created on " + xmlCreationDate + " and ";
outputMessage += "contains " + childrenCount + " child elements.";
Console.WriteLine(outputMessage);
}
// Compare the first two occurrences of an attribute
// in the specified security element.
private static void CompareAttributes(
SecurityElement xmlElement, string attributeName)
{
// Create a hash table containing the security element's attributes.
Hashtable attributeKeys = xmlElement.Attributes;
string attributeValue = attributeKeys[attributeName].ToString();
foreach(SecurityElement xmlChild in xmlElement.Children)
{
if (attributeValue.Equals(xmlChild.Attribute(attributeName)))
{
// The security elements were created at the exact same time.
}
}
}
// Convert the contents of the specified security element
// to hash codes stored in a hash table.
private static void ConvertToHashTable(SecurityElement xmlElement)
{
// Create a hash table to hold hash codes of the security elements.
Hashtable xmlAsHash = new Hashtable();
int rootIndex = xmlElement.GetHashCode();
xmlAsHash.Add(rootIndex, "root");
int parentNum = 0;
foreach(SecurityElement xmlParent in xmlElement.Children)
{
parentNum++;
xmlAsHash.Add(xmlParent.GetHashCode(), "parent" + parentNum);
if ((xmlParent.Children != null) &&
(xmlParent.Children.Count > 0))
{
int childNum = 0;
foreach(SecurityElement xmlChild in xmlParent.Children)
{
childNum++;
xmlAsHash.Add(xmlChild.GetHashCode(), "child" + childNum);
}
}
}
}
// Delete the specified security element if the current time is past
// the time stored in the destroytime tag.
private static SecurityElement DestroyTree(SecurityElement xmlElement)
{
SecurityElement localXmlElement = xmlElement;
SecurityElement destroyElement =
localXmlElement.SearchForChildByTag("destroytime");
// Verify that a destroytime tag exists.
if (localXmlElement.SearchForChildByTag("destroytime") != null)
{
// Retrieve the destroytime text to get the time
// the tree can be destroyed.
string storedDestroyTime =
localXmlElement.SearchForTextOfTag("destroytime");
DateTime destroyTime = DateTime.Parse(storedDestroyTime);
if (DateTime.Now > destroyTime)
{
localXmlElement = null;
Console.WriteLine("The XML security tree has been deleted.");
}
}
// Verify that xmlElement is of type SecurityElement.
if (xmlElement.GetType().Equals(
typeof(System.Security.SecurityElement)))
{
// Determine whether the localXmlElement object
// differs from xmlElement.
if (xmlElement.Equals(localXmlElement))
{
// Verify that the tags, attributes and children of the
// two security elements are identical.
if (xmlElement.Equal(localXmlElement))
{
// Return the original security element.
return xmlElement;
}
}
}
// Return the modified security element.
return localXmlElement;
}
}
//
// This sample produces the following output:
//
// The security XML tree named RootTag(XML security tree)
// was created on 2/23/2004 1:23:00 PM and contains 2 child elements.
//<RootTag creationdate="2/23/2004 1:23:00 PM">XML security tree
// <destroytime>2/23/2004 1:23:01 PM</destroytime>
// <WindowsMembership.WindowsRole version="1.00"
// creationdate="2/23/2004 1:23:00 PM">
// <BabyElement>This is a child element.</BabyElement>
//
//This sample completed successfully; press Exit to continue.
Imports System.Security
Imports System.Collections
Class SecurityElementMembers
<STAThread()> _
Shared Sub Main(ByVal args() As String)
Dim xmlRootElement As New SecurityElement("RootTag", "XML security tree")
AddAttribute(xmlRootElement, "creationdate", DateTime.Now.ToString())
AddChildElement(xmlRootElement, "destroytime", DateTime.Now.AddSeconds(1.0).ToString())
Dim windowsRoleElement As New SecurityElement("WindowsMembership.WindowsRole")
windowsRoleElement.AddAttribute("version", "1.00")
' Add a child element and a creationdate attribute.
AddChildElement(windowsRoleElement, "BabyElement", "This is a child element")
AddAttribute(windowsRoleElement, "creationdate", DateTime.Now.ToString())
xmlRootElement.AddChild(windowsRoleElement)
CompareAttributes(xmlRootElement, "creationdate")
ConvertToHashTable(xmlRootElement)
DisplaySummary(xmlRootElement)
' Determine if the security element is too old to keep.
xmlRootElement = DestroyTree(xmlRootElement)
If Not (xmlRootElement Is Nothing) Then
Dim elementInXml As String = xmlRootElement.ToString()
Console.WriteLine(elementInXml)
End If
Console.WriteLine("This sample completed successfully; " + "press Enter to exit.")
Console.ReadLine()
End Sub
' Add an attribute to the specified security element.
Private Shared Function AddAttribute(ByVal xmlElement As SecurityElement, ByVal attributeName As String, ByVal attributeValue As String) As SecurityElement
If Not (xmlElement Is Nothing) Then
' Verify that the attribute name and value are valid XML formats.
If SecurityElement.IsValidAttributeName(attributeName) AndAlso SecurityElement.IsValidAttributeValue(attributeValue) Then
' Add the attribute to the security element.
xmlElement.AddAttribute(attributeName, attributeValue)
End If
End If
Return xmlElement
End Function 'AddAttribute
' Add a child element to the specified security element.
Private Shared Function AddChildElement(ByVal parentElement As SecurityElement, ByVal tagName As String, ByVal tagText As String) As SecurityElement
If Not (parentElement Is Nothing) Then
' Ensure that the tag text is in valid XML format.
If Not SecurityElement.IsValidText(tagText) Then
' Replace invalid text with valid XML text
' to enforce proper XML formatting.
tagText = SecurityElement.Escape(tagText)
End If
' Determine whether the tag is in valid XML format.
If SecurityElement.IsValidTag(tagName) Then
Dim childElement As SecurityElement
childElement = parentElement.SearchForChildByTag(tagName)
If Not (childElement Is Nothing) Then
Dim elementText As String
elementText = parentElement.SearchForTextOfTag(tagName)
If Not elementText.Equals(tagText) Then
' Add child element to the parent security element.
parentElement.AddChild(New SecurityElement(tagName, tagText))
End If
Else
' Add child element to the parent security element.
parentElement.AddChild(New SecurityElement(tagName, tagText))
End If
End If
End If
Return parentElement
End Function 'AddChildElement
' Create and display a summary sentence
' about the specified security element.
Private Shared Sub DisplaySummary(ByVal xmlElement As SecurityElement)
' Retrieve tag name for the security element.
Dim xmlTreeName As String = xmlElement.Tag.ToString()
' Retrieve tag text for the security element.
Dim xmlTreeDescription As String = xmlElement.Text
' Retrieve value of the creationdate attribute.
Dim xmlCreationDate As String = xmlElement.Attribute("creationdate")
' Retrieve the number of children under the security element.
Dim childrenCount As String = xmlElement.Children.Count.ToString()
Dim outputMessage As String = "The security XML tree named " + xmlTreeName
outputMessage += "(" + xmlTreeDescription + ")"
outputMessage += " was created on " + xmlCreationDate + " and "
outputMessage += "contains " + childrenCount + " child elements."
Console.WriteLine(outputMessage)
End Sub
' Compare the first two occurrences of an attribute
' in the specified security element.
Private Shared Sub CompareAttributes(ByVal xmlElement As SecurityElement, ByVal attributeName As String)
' Create a hash table containing the security element's attributes.
Dim attributeKeys As Hashtable = xmlElement.Attributes
Dim attributeValue As String = attributeKeys(attributeName).ToString()
Dim xmlChild As SecurityElement
For Each xmlChild In xmlElement.Children
If attributeValue.Equals(xmlChild.Attribute(attributeName)) Then
End If
Next xmlChild
' The security elements were created at the exact same time.
End Sub
' Convert the contents of the specified security element
' to hash codes stored in a hash table.
Private Shared Sub ConvertToHashTable(ByVal xmlElement As SecurityElement)
' Create a hash table to hold hash codes of the security elements.
Dim xmlAsHash As New Hashtable()
Dim rootIndex As Integer = xmlElement.GetHashCode()
xmlAsHash.Add(rootIndex, "root")
Dim parentNum As Integer = 0
Dim xmlParent As SecurityElement
For Each xmlParent In xmlElement.Children
parentNum += 1
xmlAsHash.Add(xmlParent.GetHashCode(), "parent" + parentNum.ToString())
If Not (xmlParent.Children Is Nothing) AndAlso xmlParent.Children.Count > 0 Then
Dim childNum As Integer = 0
Dim xmlChild As SecurityElement
For Each xmlChild In xmlParent.Children
childNum += 1
xmlAsHash.Add(xmlChild.GetHashCode(), "child" + childNum.ToString())
Next xmlChild
End If
Next xmlParent
End Sub
' Delete the specified security element if the current time is past
' the time stored in the destroytime tag.
Private Shared Function DestroyTree(ByVal xmlElement As SecurityElement) As SecurityElement
Dim localXmlElement As SecurityElement = xmlElement
Dim destroyElement As SecurityElement = localXmlElement.SearchForChildByTag("destroytime")
' Verify that a destroytime tag exists.
If Not (localXmlElement.SearchForChildByTag("destroytime") Is Nothing) Then
' Retrieve the destroytime text to get the time
' the tree can be destroyed.
Dim storedDestroyTime As String = localXmlElement.SearchForTextOfTag("destroytime")
Dim destroyTime As DateTime = DateTime.Parse(storedDestroyTime)
If DateTime.Now > destroyTime Then
localXmlElement = Nothing
Console.WriteLine("The XML security tree has been deleted.")
End If
End If
' Verify that xmlElement is of type SecurityElement.
If xmlElement.GetType().Equals(GetType(System.Security.SecurityElement)) Then
' Determine whether the localXmlElement object
' differs from xmlElement.
If xmlElement.Equals(localXmlElement) Then
' Verify that the tags, attributes and children of the
' two security elements are identical.
If xmlElement.Equal(localXmlElement) Then
' Return the original security element.
Return xmlElement
End If
End If
End If
' Return the modified security element.
Return localXmlElement
End Function 'DestroyTree
End Class
'
' This sample produces the following output:
'
' The security XML tree named RootTag(XML security tree)
' was created on 2/23/2004 1:23:00 PM and contains 2 child elements.
'<RootTag creationdate="2/23/2004 1:23:00 PM">XML security tree
' <destroytime>2/23/2004 1:23:01 PM</destroytime>
' <WindowsMembership.WindowsRole version="1.00"
' creationdate="2/23/2004 1:23:00 PM">
' <BabyElement>This is a child element.</BabyElement>
'
'This sample completed successfully; press Exit to continue.
注解
此类旨在成为简单 XML 对象模型的轻型实现,以便在安全系统中使用,而不是用作常规 XML 对象模型。 本文档假定对 XML 有基本的了解。
元素的简单 XML 对象模型由以下部分组成:
标记是元素名称。
属性是 元素上的零个或多个名称/值属性对。
子级是 嵌套在 和
</tag>
中的<tag>
零个或多个元素。
强烈建议使用基于属性的 XML 表示形式来表示安全元素及其值。 这意味着元素的属性表示为属性,属性值表示为属性值。 避免在标记中嵌套文本。 对于任何 <tag>text</tag>
表示形式,通常可以使用 类型的 <tag value="text"/>
表示形式。 使用这种基于特性的 XML 表示形式可提高可读性,并允许轻松实现生成的 XML 序列化的 WMI 可移植性。
属性名称必须是一个字符或更长,并且不能为 null
。 如果使用基于元素的值表示形式,则具有文本字符串 null
的元素以 形式表示 <tag/>
;否则,文本由 <tag>
和 </tag>
标记分隔。 这两种形式都可以与属性组合在一起,如果存在,则显示这些属性。
元素的标记、属性和文本(如果存在)始终区分大小写。 XML 窗体包含引号,并在必要时转义。 包含在 XML 中使用的无效字符的字符串值会导致 ArgumentException。 这些规则适用于所有属性和方法。
注意
出于性能原因,仅当元素编码为 XML 文本形式时,才会检查字符有效性,而不是在属性或方法的每组上检查字符有效性。 静态方法允许根据需要进行显式检查。
构造函数
SecurityElement(String) |
使用指定的标记初始化 SecurityElement 类的新实例。 |
SecurityElement(String, String) |
用指定的标记和文本初始化 SecurityElement 类的新实例。 |
属性
Attributes |
以名称/值对形式获取或设置 XML 元素特性。 |
Children |
获取或设置 XML 元素子元素的数组。 |
Tag |
获取或设置 XML 元素的标记名称。 |
Text |
获取或设置 XML 元素中的文本。 |
方法
AddAttribute(String, String) |
将名称/值特性添加到 XML 元素。 |
AddChild(SecurityElement) |
将子元素添加到 XML 元素。 |
Attribute(String) |
根据名称在 XML 元素中查找特性。 |
Copy() |
创建并返回当前 SecurityElement 对象的一个相同副本。 |
Equal(SecurityElement) |
比较两个 XML 元素对象,确定它们是否相等。 |
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
Escape(String) |
将字符串中的无效 XML 字符替换为与其等效的有效 XML 字符。 |
FromString(String) |
从 XML 编码的字符串创建安全元素。 |
GetHashCode() |
作为默认哈希函数。 (继承自 Object) |
GetType() |
获取当前实例的 Type。 (继承自 Object) |
IsValidAttributeName(String) |
确定字符串是否是有效的特性名。 |
IsValidAttributeValue(String) |
确定字符串是否是有效的特性值。 |
IsValidTag(String) |
确定字符串是否是有效的标记。 |
IsValidText(String) |
确定字符串是否是 XML 元素中的有效文本。 |
MemberwiseClone() |
创建当前 Object 的浅表副本。 (继承自 Object) |
SearchForChildByTag(String) |
根据标记名查找子级。 |
SearchForTextOfTag(String) |
根据标记名查找子级并返回所包含的文本。 |
ToString() |
产生 XML 元素及其构成特性、子元素和文本的字符串表示法。 |