AddParsedSubObject Method

Xml.AddParsedSubObject Method (Object)


Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

protected override void AddParsedSubObject(
	object obj


Type: System.Object

An Object that represents the parsed element.

Exception Condition

obj is not of type LiteralControl.

The following code example demonstrates how to override the AddParsedSubObject method in a custom Xml server control.

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >
        <title>Custom Xml - AddParsedSubObject - C# Example</title>
        <form id="Form1" method="post" runat="server">
            <h3>Custom Xml - AddParsedSubObject - C# Example</h3>

            <aspSample:CustomXmlAddParsedSubObject id="xml1" runat="server" 
             DocumentSource="People.xml" TransformSource="PeopleTable.xslt" />
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomXmlAddParsedSubObject : System.Web.UI.WebControls.Xml
        protected override void AddParsedSubObject(object obj)
            // Call the base AddParseSubObject method.

            // Note: This method does not get called when transforming XML.

.NET Framework
Available since 1.1
Return to top
© 2016 Microsoft