SecurityElement Class

 

Represents the XML object model for encoding security objects. This class cannot be inherited.

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

System.Object
  System.Security.SecurityElement

[<Sealed>]
[<SerializableAttribute>]
[<ComVisibleAttribute(true)>]
type SecurityElement = class end

NameDescription
System_CAPS_pubmethodSecurityElement(String)

Initializes a new instance of the SecurityElement class with the specified tag.

System_CAPS_pubmethodSecurityElement(String, String)

Initializes a new instance of the SecurityElement class with the specified tag and text.

NameDescription
System_CAPS_pubpropertyAttributes

Gets or sets the attributes of an XML element as name/value pairs.

System_CAPS_pubpropertyChildren

Gets or sets the array of child elements of the XML element.

System_CAPS_pubpropertyTag

Gets or sets the tag name of an XML element.

System_CAPS_pubpropertyText

Gets or sets the text within an XML element.

NameDescription
System_CAPS_pubmethodAddAttribute(String, String)

Adds a name/value attribute to an XML element.

System_CAPS_pubmethodAddChild(SecurityElement)

Adds a child element to the XML element.

System_CAPS_pubmethodAttribute(String)

Finds an attribute by name in an XML element.

System_CAPS_pubmethodCopy()

Creates and returns an identical copy of the current SecurityElement object.

System_CAPS_pubmethodEqual(SecurityElement)

Compares two XML element objects for equality.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticEscape(String)

Replaces invalid XML characters in a string with their valid XML equivalent.

System_CAPS_pubmethodSystem_CAPS_staticFromString(String)

Creates a security element from an XML-encoded string.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticIsValidAttributeName(String)

Determines whether a string is a valid attribute name.

System_CAPS_pubmethodSystem_CAPS_staticIsValidAttributeValue(String)

Determines whether a string is a valid attribute value.

System_CAPS_pubmethodSystem_CAPS_staticIsValidTag(String)

Determines whether a string is a valid tag.

System_CAPS_pubmethodSystem_CAPS_staticIsValidText(String)

Determines whether a string is valid as text within an XML element.

System_CAPS_pubmethodSearchForChildByTag(String)

Finds a child by its tag name.

System_CAPS_pubmethodSearchForTextOfTag(String)

Finds a child by its tag name and returns the contained text.

System_CAPS_pubmethodToString()

Produces a string representation of an XML element and its constituent attributes, child elements, and text.(Overrides Object.ToString().)

This class is intended to be a lightweight implementation of a simple XML object model for use within the security system, and not for use as a general XML object model. This documentation assumes a basic knowledge of XML.

The simple XML object model for an element consists of the following parts:

  • The tag is the element name.

  • The attributes are zero or more name/value attribute pairs on the element.

  • The children are zero or more elements nested within <tag> and </tag>.

It is strongly suggested that attribute based XML representation is used to express security elements and their values. This means properties of an element are expressed as attributes and property values are expressed as attribute values. Avoid nesting text within tags. For any <tag>text</tag> representation a representation of type <tag value="text"/> is usually available. Using this attribute-based XML representation increases readability and allows easy WMI portability of the resulting XML serialization.

An attribute name must be one character or longer, and cannot be null. If element-based value representation is used, elements with a text string that is null are represented in the <tag/> form; otherwise, text is delimited by the <tag> and </tag> tokens. Both forms can be combined with attributes, which are shown if present.

The tags, attributes, and text of elements, if present, are always case-sensitive. The XML form contains quotations and escapes where necessary. String values that include characters invalid for use in XML result in an ArgumentException. These rules apply to all properties and methods.

System_CAPS_noteNote

For performance reasons, character validity is only checked when the element is encoded into XML text form, and not on every set of a property or method. Static methods allow explicit checking where needed.

The following example shows the use of members of the SecurityElement class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: