XamlReader.Parse Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads the markup in the specified text string and returns an object that corresponds to the root of the specified markup.
Overloads
| Name | Description |
|---|---|
| Parse(String, ParserContext) |
Reads the XAML markup in the specified text string (using a specified ParserContext) and returns an object that corresponds to the root of the specified markup. |
| Parse(String) |
Reads the XAML input in the specified text string and returns an object that corresponds to the root of the specified markup. |
| Parse(String, Boolean) |
Reads the XAML input in the specified text string and returns the root of the corresponding object tree. |
| Parse(String, ParserContext, Boolean) |
Reads the XAML input in the specified text string by using the specified ParserContext and returns the root of the corresponding object tree. |
Parse(String, ParserContext)
Reads the XAML markup in the specified text string (using a specified ParserContext) and returns an object that corresponds to the root of the specified markup.
public:
static System::Object ^ Parse(System::String ^ xamlText, System::Windows::Markup::ParserContext ^ parserContext);
public static object Parse(string xamlText, System.Windows.Markup.ParserContext parserContext);
static member Parse : string * System.Windows.Markup.ParserContext -> obj
Public Shared Function Parse (xamlText As String, parserContext As ParserContext) As Object
Parameters
- xamlText
- String
The input XAML, as a single text string.
- parserContext
- ParserContext
Context information used by the parser.
Returns
The root of the created object tree.
Remarks
The implementation calls Load internally after creating a stream from the string. See Load for additional information such as possible exceptions.
Applies to
Parse(String)
Reads the XAML input in the specified text string and returns an object that corresponds to the root of the specified markup.
public:
static System::Object ^ Parse(System::String ^ xamlText);
public static object Parse(string xamlText);
static member Parse : string -> obj
Public Shared Function Parse (xamlText As String) As Object
Parameters
- xamlText
- String
The input XAML, as a single text string.
Returns
The root of the created object tree.
Remarks
The implementation calls Load internally after creating a stream from the string. See Load for additional information such as possible exceptions.
Applies to
Parse(String, Boolean)
Reads the XAML input in the specified text string and returns the root of the corresponding object tree.
public:
static System::Object ^ Parse(System::String ^ xamlText, bool useRestrictiveXamlReader);
public static object Parse(string xamlText, bool useRestrictiveXamlReader);
static member Parse : string * bool -> obj
Public Shared Function Parse (xamlText As String, useRestrictiveXamlReader As Boolean) As Object
Parameters
- xamlText
- String
The XAML input, as a single text string.
- useRestrictiveXamlReader
- Boolean
true to restrict the instantiation of potentially dangerous types; otherwise, false.
Returns
The root of the created object tree.
Exceptions
xamlText is null.
Remarks
Restrictive mode is a defense-in-depth measure. Don't treat a restrictive parse of untrusted XAML as safe or as a replacement for isolation in a low-privilege sandbox.
Applies to
Parse(String, ParserContext, Boolean)
Reads the XAML input in the specified text string by using the specified ParserContext and returns the root of the corresponding object tree.
public:
static System::Object ^ Parse(System::String ^ xamlText, System::Windows::Markup::ParserContext ^ parserContext, bool useRestrictiveXamlReader);
public static object Parse(string xamlText, System.Windows.Markup.ParserContext parserContext, bool useRestrictiveXamlReader);
static member Parse : string * System.Windows.Markup.ParserContext * bool -> obj
Public Shared Function Parse (xamlText As String, parserContext As ParserContext, useRestrictiveXamlReader As Boolean) As Object
Parameters
- xamlText
- String
The XAML input, as a single text string.
- parserContext
- ParserContext
Context information used by the parser.
- useRestrictiveXamlReader
- Boolean
true to restrict the instantiation of potentially dangerous types; otherwise, false.
Returns
The root of the created object tree.
Exceptions
xamlText is null.
Remarks
Restrictive mode is a defense-in-depth measure. Don't treat a restrictive parse of untrusted XAML as safe or as a replacement for isolation in a low-privilege sandbox.