Jump to content
ebandiera

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.

CODE_W3.txt

Edited by ebandiera

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...