I am creating an xml document in c# used the following code to create
xml declaration at top of the file
XmlNode docNode = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
xmlDoc.AppendChild(docNode);
and I am getting the xml declaration as follows:
<?xml version=\1.0\ encoding=\ utf-8\ ?>
What i need is <?xml version="1.0" encoding="UTF-8"?>
Tried string manipulation to remove the '\' character with double quote but the value is not changing, what changes should i make? This is the whole code for creating the remaining nodes and all
XmlDocument xmlDoc = new XmlDocument();
XmlNode docNode = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
xmlDoc.AppendChild(docNode);
XmlNode rootNode = xmlDoc.CreateElement("urlset");
XmlAttribute attribute = xmlDoc.CreateAttribute("xmlns");
attribute.Value = "www.test.com";
rootNode.Attributes.Append(attribute);
xmlDoc.AppendChild(rootNode);
xmlDoc.Save("test-doc.xml");