I tried to save some elements from my application in an XML file, but when I started developing it using this code:
public static void WriteInFile(string savefilepath) { XmlWriter writer = XmlWriter.Create(savefilepath); WriteXMLFile(writer); } private static void WriteXMLFile(XmlWriter writer) //Write and Create XML profile for specific type { writer.WriteStartDocument(); writer.WriteStartElement("cmap"); writer.WriteAttributeString("xmlns", "dcterms",null, "http://purl.org/dc/terms/"); writer.WriteElementString("xmlns", "http://cmap.ihmc.us/xml/cmap/"); // writer.WriteAttributeString("xmlns","dc",null, "http://purl.org/dc/elements/1.1/"); //writer.WriteAttributeString("xmlns", "vcard", null, "http://www.w3.org/2001/vcard-rdf/3.0#"); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); }
I found that the output in notepad is on the same line as follows:
<?xml version="1.0" encoding="utf-8"?><cmap xmlns:dcterms="http://purl.org/dc/terms/"><xmlns>http://cmap.ihmc.us/xml/cmap/</xmlns></cmap>
I want it to appear as multi-line:
<?xml version="1.0" encoding="utf-8"?> <cmap xmlns:dcterms="http://purl.org/dc/terms/"><xmlns>http://cmap.ihmc.us/xml/cmap/</xmlns> </cmap>
kartal source share