Vikas Singh

Vikas Singh

  • 1.3k
  • 410
  • 14.9k

When opening XML into notepad It is <> encrypted.

Jun 16 2022 12:39 PM

When I am creating xml through XMLWRITER after xml generation when i am opening it into notepad then <![CDATA[" + CSVcoloumn.Name + "]]> these angle breakts is encrypted like &lt;![CDATA[3335BR]]&gt; Please help.

Even i also use Encoding but it is not working please help 

I am using this method to create xml

 var writerSettings = new XmlWriterSettings
            {
                Encoding = Encoding.UTF8,
                Indent = true,
                OmitXmlDeclaration = true,
                ConformanceLevel = ConformanceLevel.Fragment,
                CloseOutput = false
            };

 using (var writer = XmlWriter.Create(XMLFilepath, writerSettings))
            {
                writer.WriteStartElement("jobs");
                foreach (var CSVcoloumn in CSVjobslist)
                {
                    writer.WriteStartElement("job");
                    writer.WriteElementString("name", "<![CDATA[" + CSVcoloumn.Name + "]]>");
                }

             }

and this is the output when i am opening in notepad

 <job>
    <name>&lt;![CDATA[3335BR]]&gt;</name>
    <site_id>&lt;![CDATA[6015]]&gt;</site_id>
    <client_id>&lt;![CDATA[ ]]&gt;</client_id>


Answers (1)