public sealed class SecurityElement { // Public Constructors public SecurityElement(string tag); public SecurityElement(string tag, string text); // Public Instance Properties public Hashtable Attributes{set; get; } public ArrayList Children{set; get; } public string Tag{set; get; } public string Text{set; get; } // Public Static Methods public static string Escape(string str); public static bool IsValidAttributeName(string name); public static bool IsValidAttributeValue(string value); public static bool IsValidTag(string tag); public static bool IsValidText(string text); // Public Instance Methods public void AddAttribute(string name, string value); public void AddChild(SecurityElement child); public string Attribute(string name); public bool Equal(SecurityElement other); public SecurityElement SearchForChildByTag(string tag); public string SearchForTextOfTag(string tag); public override string ToString( ); // overrides object }
This class implements a simple, lightweight XML object model for encoding .NET security objects. A SecurityElement object represents a single XML element that can contain a tag, attributes, and text. To build a hierarchy of XML objects, add SecurityElement objects representing the child nodes to an existing SecurityElement object using its Children property or AddChild( ) method. The ToString( ) method returns a string containing the XML representation of the SecurityElement and all of its children.