| | |
Convert an XML file into a Binary Format File
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
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
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, then write this data to your binary file
C# Syntax (Toggle Plain Text)
string xmlData = File.ReadAllText("path.xml");
C# Syntax (Toggle Plain Text)
FileStream fs = new FileStream("path.txt", FileMode.OpenOrCreate); BinaryWriter sw = new BinaryWriter(fs); sw.Write(s); sw.Close();
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
•
•
Just read your XML file as normal file,then write this data to your binary fileC# Syntax (Toggle Plain Text)
string xmlData = File.ReadAllText("path.xml");
C# Syntax (Toggle Plain Text)
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!!!
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
System.Security.Cryptography may help you for stronger and better encryption!
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Similar Threads
- converting a text or xml file into binary format (Visual Basic 4 / 5 / 6)
Other Threads in the C# Forum
- Previous Thread: How would I send a remote command to a UNIX box from a PC using C#?
- Next Thread: C# Forms View
| Thread Tools | Search this Thread |
.net access algorithm angle array asp.net barchart bitmap box broadcast c# capturing check checkbox client combobox control conversion csharp custom database datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum eventhandlers excel file firefox form format forms function gdi+ image index input install java label leak libraries list listbox loop mandelbrot math monodevelop mouseclick msword mysql operator path pause photoshop picturebox pixelinversion post programming radians regex remoting resourcefile richtextbox round server sleep socket sql statistics stream string table tcpclientchannel text textbox thread time timer update usercontrol validation virtualization visualbasic visualstudio webbrowser windows winforms wpf xml






