mscorlib(4.0.0.0) API with additions
System.Security.SecurityElement Class Reference

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

Inherits System.Security.ISecurityElementFactory.

Public Member Functions

 SecurityElement (string tag)
 Initializes a new instance of the T:System.Security.SecurityElement class with the specified tag. More...
 
 SecurityElement (string tag, string text)
 Initializes a new instance of the T:System.Security.SecurityElement class with the specified tag and text. More...
 
void AddAttribute (string name, string value)
 Adds a name/value attribute to an XML element. More...
 
void AddChild (SecurityElement child)
 Adds a child element to the XML element. More...
 
bool Equal (SecurityElement other)
 Compares two XML element objects for equality. More...
 
SecurityElement Copy ()
 Creates and returns an identical copy of the current T:System.Security.SecurityElement object. More...
 
override string ToString ()
 Produces a string representation of an XML element and its constituent attributes, child elements, and text. More...
 
string Attribute (string name)
 Finds an attribute by name in an XML element. More...
 
SecurityElement SearchForChildByTag (string tag)
 Finds a child by its tag name. More...
 
string SearchForTextOfTag (string tag)
 Finds a child by its tag name and returns the contained text. More...
 

Static Public Member Functions

static SecurityElement FromString (string xml)
 Creates a security element from an XML-encoded string. More...
 
static bool IsValidTag (string tag)
 Determines whether a string is a valid tag. More...
 
static bool IsValidText (string text)
 Determines whether a string is valid as text within an XML element. More...
 
static bool IsValidAttributeName (string name)
 Determines whether a string is a valid attribute name. More...
 
static bool IsValidAttributeValue (string value)
 Determines whether a string is a valid attribute value. More...
 
static string Escape (string str)
 Replaces invalid XML characters in a string with their valid XML equivalent. More...
 

Properties

string Tag [get, set]
 Gets or sets the tag name of an XML element. More...
 
Hashtable Attributes [get, set]
 Gets or sets the attributes of an XML element as name/value pairs. More...
 
string Text [get, set]
 Gets or sets the text within an XML element. More...
 
ArrayList Children [get, set]
 Gets or sets the array of child elements of the XML element. More...
 

Detailed Description

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

Definition at line 14 of file SecurityElement.cs.

Constructor & Destructor Documentation

◆ SecurityElement() [1/2]

System.Security.SecurityElement.SecurityElement ( string  tag)

Initializes a new instance of the T:System.Security.SecurityElement class with the specified tag.

Parameters
tagThe tag name of an XML element.
Exceptions
T:System.ArgumentNullExceptionThe tag parameter is null.
T:System.ArgumentExceptionThe tag parameter is invalid in XML.

Definition at line 246 of file SecurityElement.cs.

◆ SecurityElement() [2/2]

System.Security.SecurityElement.SecurityElement ( string  tag,
string  text 
)

Initializes a new instance of the T:System.Security.SecurityElement class with the specified tag and text.

Parameters
tagThe tag name of the XML element.
textThe text content within the element.
Exceptions
T:System.ArgumentNullExceptionThe tag parameter is null.
T:System.ArgumentExceptionThe tag parameter or text parameter is invalid in XML.

Definition at line 265 of file SecurityElement.cs.

Member Function Documentation

◆ AddAttribute()

void System.Security.SecurityElement.AddAttribute ( string  name,
string  value 
)

Adds a name/value attribute to an XML element.

Parameters
nameThe name of the attribute.
valueThe value of the attribute.
Exceptions
T:System.ArgumentNullExceptionThe name parameter or value parameter is null.
T:System.ArgumentExceptionThe name parameter or value parameter is invalid in XML.-or- An attribute with the name specified by the name parameter already exists.

Definition at line 326 of file SecurityElement.cs.

◆ AddChild()

void System.Security.SecurityElement.AddChild ( SecurityElement  child)

Adds a child element to the XML element.

Parameters
childThe child element to add.
Exceptions
T:System.ArgumentNullExceptionThe child parameter is null.

Definition at line 350 of file SecurityElement.cs.

◆ Attribute()

string System.Security.SecurityElement.Attribute ( string  name)

Finds an attribute by name in an XML element.

Parameters
nameThe name of the attribute for which to search.
Returns
The value associated with the named attribute, or null if no attribute with name exists.
Exceptions
T:System.ArgumentNullExceptionThe name parameter is null.

Definition at line 730 of file SecurityElement.cs.

◆ Copy()

SecurityElement System.Security.SecurityElement.Copy ( )

Creates and returns an identical copy of the current T:System.Security.SecurityElement object.

Returns
A copy of the current T:System.Security.SecurityElement object.

Definition at line 474 of file SecurityElement.cs.

◆ Equal()

bool System.Security.SecurityElement.Equal ( SecurityElement  other)

Compares two XML element objects for equality.

Parameters
otherAn XML element object to which to compare the current XML element object.
Returns
true if the tag, attribute names and values, child elements, and text fields in the current XML element are identical to their counterparts in the other parameter; otherwise, false.

Definition at line 402 of file SecurityElement.cs.

◆ Escape()

static string System.Security.SecurityElement.Escape ( string  str)
static

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

Parameters
strThe string within which to escape invalid characters.
Returns
The input string with invalid characters replaced.

Definition at line 548 of file SecurityElement.cs.

◆ FromString()

static SecurityElement System.Security.SecurityElement.FromString ( string  xml)
static

Creates a security element from an XML-encoded string.

Parameters
xmlThe XML-encoded string from which to create the security element.
Returns
A T:System.Security.SecurityElement created from the XML.
Exceptions
T:System.Security.XmlSyntaxExceptionxml contains one or more single quotation mark characters.
T:System.ArgumentNullExceptionxml is null.

Definition at line 233 of file SecurityElement.cs.

◆ IsValidAttributeName()

static bool System.Security.SecurityElement.IsValidAttributeName ( string  name)
static

Determines whether a string is a valid attribute name.

Parameters
nameThe attribute name to test for validity.
Returns
true if the name parameter is a valid XML attribute name; otherwise, false.

Definition at line 512 of file SecurityElement.cs.

◆ IsValidAttributeValue()

static bool System.Security.SecurityElement.IsValidAttributeValue ( string  value)
static

Determines whether a string is a valid attribute value.

Parameters
valueThe attribute value to test for validity.
Returns
true if the value parameter is a valid XML attribute value; otherwise, false.

Definition at line 521 of file SecurityElement.cs.

◆ IsValidTag()

static bool System.Security.SecurityElement.IsValidTag ( string  tag)
static

Determines whether a string is a valid tag.

Parameters
tagThe tag to test for validity.
Returns
true if the tag parameter is a valid XML tag; otherwise, false.

Definition at line 486 of file SecurityElement.cs.

◆ IsValidText()

static bool System.Security.SecurityElement.IsValidText ( string  text)
static

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

Parameters
textThe text to test for validity.
Returns
true if the text parameter is a valid XML text element; otherwise, false.

Definition at line 499 of file SecurityElement.cs.

◆ SearchForChildByTag()

SecurityElement System.Security.SecurityElement.SearchForChildByTag ( string  tag)

Finds a child by its tag name.

Parameters
tagThe tag for which to search in child elements.
Returns
The first child XML element with the specified tag value, or null if no child element with tag exists.
Exceptions
T:System.ArgumentNullExceptionThe tag parameter is null.

Definition at line 757 of file SecurityElement.cs.

◆ SearchForTextOfTag()

string System.Security.SecurityElement.SearchForTextOfTag ( string  tag)

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

Parameters
tagThe tag for which to search in child elements.
Returns
The text contents of the first child element with the specified tag value.
Exceptions
T:System.ArgumentNullExceptiontag is null.

Definition at line 839 of file SecurityElement.cs.

◆ ToString()

override string System.Security.SecurityElement.ToString ( )

Produces a string representation of an XML element and its constituent attributes, child elements, and text.

Returns
The XML element and its contents.

Definition at line 642 of file SecurityElement.cs.

Property Documentation

◆ Attributes

Hashtable System.Security.SecurityElement.Attributes
getset

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

Returns
The T:System.Collections.Hashtable object for the attribute values of the XML element.
Exceptions
T:System.InvalidCastExceptionThe name or value of the T:System.Collections.Hashtable object is invalid.
T:System.ArgumentExceptionThe name is not a valid XML attribute name.

Definition at line 106 of file SecurityElement.cs.

◆ Children

ArrayList System.Security.SecurityElement.Children
getset

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

Returns
The ordered child elements of the XML element as security elements.
Exceptions
T:System.ArgumentExceptionA child of the XML parent node is null.

Definition at line 177 of file SecurityElement.cs.

◆ Tag

string System.Security.SecurityElement.Tag
getset

Gets or sets the tag name of an XML element.

Returns
The tag name of an XML element.
Exceptions
T:System.ArgumentNullExceptionThe tag is null.
T:System.ArgumentExceptionThe tag is not valid in XML.

Definition at line 82 of file SecurityElement.cs.

◆ Text

string System.Security.SecurityElement.Text
getset

Gets or sets the text within an XML element.

Returns
The value of the text within an XML element.
Exceptions
T:System.ArgumentExceptionThe text is not valid in XML.

Definition at line 153 of file SecurityElement.cs.


The documentation for this class was generated from the following file: