Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am generating a code which is same as generated by "Schneider app" but the problem:
my XML code is differ than their XML code.
if i opened my xml code with text editor it comes different "less spaces before the view"..

the problem that i can't import my file to their side.
but if i change my file format to .xml ,i can import it.
so my question how to get the same xml format in text editor and why they have extra spaces in their "text view".

i'm writing xml with the below


VB
Dim saveFile As New SaveFileDialog()
  saveFile.InitialDirectory = "Desktop"
  saveFile.FileName = fb.Text
  saveFile.Filter = "XML Files Only(*.XML) | *.XML"
  saveFile.ShowDialog()

  Dim doc As XmlDocument = New XmlDocument()
  doc.LoadXml(GenCodeText.Text)
  doc.PreserveWhitespace = false
  doc.Save(saveFile.FileName)


below is my generated code and their generated code.

http://www.4shared.com/rar/7p-WJ31j/Codes.html?[^]
Posted
Comments
Christian Graus 13-Dec-12 3:43am    
sorry, I don't care enough to download and try to open a rar. However, have you tried setting PreserveWhitespace to true ? Why can't you just post the XML here so we can see it ?
Ahmed.ganainy 13-Dec-12 5:12am    
PreserveWhitespace to true will generate xml code but if i opened it in text viewer it will comes in only one long line.
xml will show that they are same.but in text viewer they are different.
Ahmed.ganainy 13-Dec-12 5:12am    
PreserveWhitespace to true will generate xml code but if i opened it in text viewer it will comes in only one long line.

http://imageshack.us/f/845/codesx.png/
Ahmed.ganainy 14-Dec-12 1:25am    
for more clarification:
i am writing a code as string similar to Schneider code with the above code "doc.LoadXml(GenCodeText.Text)". and it gives me a valid xml code but the issue when i opened it as txt it shows me different format and if i put "doc.PreserveWhitespace = True" i found the text view of xml file comes in one line only.

1 solution

I added the original file to the resources and then write text to it directly...it's working.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900