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

Encrypt your data!!!

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

System.Security.Cryptography may help you for stronger and better encryption!

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


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

***

  1. Hello Program
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.