System.Xml.XmlEmptyElementWhitespace Class

Represents a whitespace node that appears in the XML document after an empty element. This class is used internally by the XML DOM and is not typically created directly by user code.

Namespace

System.Xml

Assembly

System.Xml.dll

Syntax

<!ELEMENT?> // Internal representation for whitespace after empty tags

Inheritance Hierarchy

Members

MemberDescription
CloneNode(bool deep)Creates a duplicate of this node.
OuterXml (get)Gets the markup representing this node and all its children.
InnerText (get/set)Gets or sets the concatenated values of the node and all its child nodes.

Remarks

The XmlEmptyElementWhitespace node is generated by the XML parser to preserve whitespace that appears after an empty element (e.g., <br /> ) when loading an XML document with PreserveWhitespace set to true. It behaves like a regular whitespace node but indicates its special position in the DOM.

Example

using System; using System.Xml; class Program { static void Main() { string xml = @"<root> <br /> <item>Value</item> </root>"; XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; doc.LoadXml(xml); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { Console.WriteLine($"{node.GetType().Name}: \"{node.OuterXml}\""); } } }

See also