CodeAccessPermission.FromXml Method

When overridden in a derived class, reconstructs a security object with a specified state from an XML encoding.

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

Public MustOverride Sub FromXml ( _
	elem As SecurityElement _
Dim instance As CodeAccessPermission
Dim elem As SecurityElement

public abstract void FromXml (
	SecurityElement elem
public abstract function FromXml (
	elem : SecurityElement
Not applicable.



The XML encoding to use to reconstruct the security object.

Exception typeCondition


The elem parameter is a null reference (Nothing in Visual Basic).


The elem parameter does not contain the XML encoding for an instance of the same type as the current instance.


The version number of the elem parameter is not supported.

Custom code that extends security objects needs to implement the ToXml and FromXml methods to make the objects security-encodable.

Notes to Inheritors: You must override this method in a derived class.

The following code example shows an override of the FromXml method. This code example is part of a larger example provided for the CodeAccessPermission class.

Public Overrides Sub FromXml(ByVal e As SecurityElement)
    ' The following code for unrestricted permission is only included as an example for
    ' permissions that allow the unrestricted state. It is of no value for this permission.
    Dim elUnrestricted As String = e.Attribute("Unrestricted")
    If Nothing <> elUnrestricted Then
        m_Unrestricted = Boolean.Parse(elUnrestricted)
    End If

    Dim elName As String = e.Attribute("Name")
    m_name = IIf(elName Is Nothing, Nothing, elName)
End Sub 'FromXml

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions