以XML格式存储文件 [英] Store file in XML
本文介绍了以XML格式存储文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想将物理文件(如JPEG,PNG等)存储在XML文件中,这意味着XML序列化.该怎么办?
Rgds,
Sachin Panchal
Hi All,
I want to store physical file like JPEGs, PNGs etc. in XML file means XML serialization. How can do this ?
Rgds,
Sachin Panchal
推荐答案
试试这篇文章:
使用序列化将对象加载并保存到XML [
Hi,
try this article:
Load and save objects to XML using serialization[^]
or just google for "story binary file in xml c#" - this will give you a lot more interesting links.
一种实现方法是将文件转换为Base64格式,请参见 http://msdn.microsoft.com/en-us/library/dhx0d524.aspx [ ^ ];将其转换回: http://msdn.microsoft.com/en-us/library/system.convert.frombase64string.aspx [ ^ ].
此字符串格式是XML安全的,可以将其存储为任何不带特殊字符的人类可读字符串.
就这样!
祝你好运.
—SA
One way to do it is converting a file into Base64 format, see http://msdn.microsoft.com/en-us/library/dhx0d524.aspx[^]; convert it back: http://msdn.microsoft.com/en-us/library/system.convert.frombase64string.aspx[^].
This string format is XML-safe, store it as any human-readable string without special characters.
That''s it!
Good luck.
—SA
这篇关于以XML格式存储文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文