Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: XML VB.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 22:21pm
Comments
Christian Graus at 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 at 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 at 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 at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
0 OriginalGriff 475
1 Maciej Los 349
2 Richard MacCutchan 220
3 BillWoodruff 219
4 Mathew Soji 160
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100