Gets or sets the level of conformance which the XmlWriter complies with.
Assembly: System.Xml (in System.Xml.dll)
If the writer detects any information items that would violate the specified level of conformance, it throws an exception. In some cases, the writer automatically corrects the conformance error. For example, the writer closes an unclosed attribute without throwing an exception.
For more information, see Data Conformance and the XmlWriter.
The following example writes an XML fragment to a memory stream.
XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; settings.ConformanceLevel = ConformanceLevel.Fragment; settings.CloseOutput = false; // Create the XmlWriter object and write some content. MemoryStream strm = new MemoryStream(); XmlWriter writer = XmlWriter.Create(strm, settings); writer.WriteElementString("orderID", "1-456-ab"); writer.WriteElementString("orderID", "2-36-00a"); writer.Flush(); writer.Close(); // Do additonal processing on the stream.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.