Does anyone know how I can write this line with the XMLWriter?
<TextChild xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">User defined 3</TextChild>
Problem here is xmlns:dt and dt:dt.
Error Message: 'dt' is a duplicate attribute name.
await writer.WriteStartElementAsync(string.Empty, "TextChild", string.Empty);
await writer.WriteAttributeStringAsync("xmlns", "dt", string.Empty, "urn:schemas-microsoft-com:datatypes");
await writer.WriteAttributeStringAsync("dt", "dt", string.Empty, "boolean");
await writer.WriteStringAsync(name);
await writer.WriteEndElementAsync();//TextChild
xmlns:dtis a namespace definition. This is not an attribute.It does not need to be created manually. It is enough to specify the namespace when creating the attribute.