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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access