Writing White-Space Characters

There may be times when you need to format your document manually. The WriteWhitespace method can be used to write white space to your XML document. It is important to note that for the white space to be considered significant, the containing element should have the xml:space attribute value set to preserve. This is because significant white space is defined as any white space inside a mixed content model or any white space inside the scope of an xml:space="preserve" attribute. The xml:space attribute can appear on any element, but an element's content model can be marked as a mixed content only in the document's DTD. Since the XmlTextReader does not recognize DTD information, the only way to mark white space as ...

Get Microsoft® .NET Compact Framework Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.