Jump to content

String to XML with Line Break


Recommended Posts

Hello, I have a little problem...I have a XML in a string variable, with Entity References. And I need to convert this string into a XMLDocument variable.

 private void button3_Click(object sender, EventArgs e)        {                XmlDocument envXML = new XmlDocument();                XmlTextWriter xtw = new XmlTextWriter("C:\\Users\\myname\\Desktop\\noisquevoa3.xml", Encoding.UTF8);                 string sLine = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +                                   "<root Id=\"ID11\">" +                                   "<Campo>Apostrofe: ' Sinal: < Enter:  Feito" +                                   "</Campo>" +                                   "</root>";                //envXML.PreserveWhitespace = true; doenst work                envXML.LoadXml(sLine);                envXML.WriteTo(xtw);                 xtw.Close();        } 

The code above is merely illustrative (this forum replaced some caracters). The real code is attached. The problem: When I call the LoadXml method, my entity disappears...My entity ' still working... Please, any help is awesome Edit: C# code.


Edited by ebandiera
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...