Hi Developers.....

I have a Problem.... I have a XML file.....n I have to Read the Data from that XML file n Create a New File and the Data is in a Binary Format.....(All the code is in C# only)

I have used the BinaryReader,BinaryWriter and BinaryFormatter but i can't able to solve this problem.....if i use the array of byte then the data comes in array is in ASCII code and then i convert each n every word into binary is a very very huge process.......Is there any Function in C#.Net by which i can convert my XML file to a Binary Format File.....

Every Comment will be Welcome.....
Thanx

Just read your XML file as normal file,

string xmlData = File.ReadAllText("path.xml");

then write this data to your binary file

FileStream fs = new FileStream("path.txt", FileMode.OpenOrCreate);
BinaryWriter sw = new BinaryWriter(fs);
sw.Write(s);
sw.Close();

Just read your XML file as normal file,

string xmlData = File.ReadAllText("path.xml");

then write this data to your binary file

FileStream fs = new FileStream("path.txt", FileMode.OpenOrCreate);
BinaryWriter sw = new BinaryWriter(fs);
sw.Write(s);
sw.Close();

No, Its Not Working......it shows the same data........in XML format

Thanx for the Nice Advice......but i have done it .....by using........BinaryFormatter.....

      **Hi Diwakar*Hey what are you doing???


#include<iostream>
using namespace std;
int main()
{
cout<<"Hello C++"<<endl;
return 0;
}

***

  1. Hello Program
This article has been dead for over six months. Start a new discussion instead.