Click here to Skip to main content
Sign Up to vote bad
good
See more: XMLVB.NET
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
 

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 12 Dec '12 - 21:21

Comments
Christian Graus - 13 Dec '12 - 3:43
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:12
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:12
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:25
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.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 358
1 OriginalGriff 355
2 Arun Vasu 345
3 Maciej Los 208
4 Zoltán Zörgő 189
0 Sergey Alexandrovich Kryukov 9,755
1 OriginalGriff 7,559
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 14 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid