System.Web.UI.WebControls.Xml Class

Displays an XML document without formatting or using Extensible Stylesheet Language Transformations (XSLT).

See Also: Xml Members

Syntax

[System.Web.UI.ControlBuilder(typeof(System.Web.UI.WebControls.XmlBuilder))]
[System.Web.UI.PersistChildren(true)]
[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.XmlDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultProperty("DocumentSource")]
public class Xml : System.Web.UI.Control

Remarks

In this topic:

Introduction

Use the System.Web.UI.WebControls.Xml control to display the contents of an XML document without formatting or using XSL Transformations.

Specifying XML Data

The XML document to display is specified by setting one of three properties. These three properties represent the different types of XML documents that can be displayed. You can display a System.Xml.XmlDocument, an XML string, or an XML file by setting the appropriate property. The following table lists the properties for specifying the XML document.

Xml.Document

Sets the XML document using a System.Xml.XmlDocument object.

This property is obsolete. Use one of the other properties listed in this section to set the XML content for the System.Web.UI.WebControls.Xml control.
Xml.DocumentContent

Sets the XML document using a string.

This property is commonly set declaratively by placing text between the opening and closing <asp:Xml> tags of the System.Web.UI.WebControls.Xml control.
Xml.DocumentSource

Sets the XML document using a file.

Note:

At least one of the XML document properties must be set to display an XML document. If more than one XML document property is set, the XML document referenced in the last property set is displayed. The documents in the other properties are ignored.

Specifying an XSL Transformation

You can optionally specify an XSL Transformation (XSLT) style sheet that formats the XML document before it is written to the output stream by setting one of two properties. The two properties represent the different types of XSL Transformation style sheets that can be used to format the XML document. You can format the XML document with a System.Xml.Xsl.XslCompiledTransform object or with an XSL Transformation style sheet file by setting the appropriate property. If no XSL Transformation style sheet is specified, the XML document is displayed using the default format. The following table lists the properties for specifying an XSL Transformation style sheet.

Xml.Transform

Formats the XML document using the specified System.Xml.Xsl.XslTransform object.

Using a System.Xml.Xsl.XslTransform object requires Full Trust permissions.
Xml.TransformSource

Formats the XML document using the specified XSL Transformation style sheet file.

Note:

The XSL Transformation style sheet is optional. You do not need to set the Xml.Transform or the Xml.TransformSource property. If both XSL Transformation style sheet properties are set, the last property set determines which XSL Transformation style sheet is used to format the XML document. The other property is ignored.

The System.Web.UI.WebControls.Xml class also provides the Xml.TransformArgumentList property, which enables you to provide the XSL Transformation style sheet with optional arguments. The arguments can be either XSL Transformations (XSLT) parameters or extension objects.

Declarative Syntax

Example

<asp:Xml
    DocumentSource="uri"
    EnableTheming="True|

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0