This documentation is archived and is not being maintained.

XhtmlMobileTextWriter Class

Provides text writer functionality for devices targeted by the XHTML adapter set, including Extensible Hypertext Markup Language (XHTML), XHTML Mobile, and Wireless Markup Language (WML).

Namespace:  System.Web.UI.MobileControls.Adapters.XhtmlAdapters
Assembly:  System.Web.Mobile (in System.Web.Mobile.dll)

[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class XhtmlMobileTextWriter : MobileTextWriter

XHTML is an XML-compliant markup that is based on HTML 4.1 and allows you to create Web sites suitable for multiple device types. It merges HTML's ease of use with XML's strict element guidelines to produce a markup language with a wide range of format and style options and reduced markup tag ambiguity. This class provides formatting capabilities that ASP.NET server controls use when rendering XHTML content to clients. The XhtmlMobileTextWriter renders markup that meets the standards of three different XHTML doc types: XHTML Basic, which supports limited style and format elements; XHTML Mobile Profile, which supports inline style sheets; and WML 2.0, which is based on XHTML 1.1 and supports cascading style sheets.

This class is used primarily by developers of custom mobile page and control adapters.

The XhtmlMobileTextWriter class can render all HTML elements, attributes, and style attributes, but, unlike the HtmlTextWriter class, does not allow title capitalization of these markup elements.

An XhtmlPageAdapter instantiates an XhtmlMobileTextWriter and depending on the capabilities of the target device, initializes a number of properties, such as SupportsNoWrapStyle, SuppressNewLine, and UseDivsForBreaks, that assist the text writer in rendering the page and its controls.

Your adapter can use a variety of methods to apply styles and control formatting:

You can use the members of this class, and any members it inherits from the MobileTextWriter class, to create custom text writers to use in a custom XHTML page or in class adapters. You can also create new derived classes that override the standard behavior of the XhtmlMobileTextWriter class.

Device filtering is required in order to use a specific adapter or text writer for a server control. For more information about device filtering, see Architectural Overview of Adaptive Control Behavior and ASP.NET Device Filtering Overview.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0