Writing elements and attributes piece by piece requires you to write the content separately from the start and end tags. Up to this point, this chapter has glossed over which methods are available for writing this content. This section will investigate these methods in more detail.
The XmlTextWriter provides the WriteString method to assist you in writing string data as content. To ensure that the resulting XML is still well-formed, the WriteString method will perform the following tasks before writing the string:
The characters &, <, and > are replaced by &, <, and >, respectively.
Character values in the range 0x–0x1F are replaced by numeric character entries. White space characters with this range ...