将TXT文档中数据导入XML文件中 C#
对于将TXT文档中数据导入XML中的程序网上不多,但是有很多是先将TXT导入到DataSet中,在用XML进行传输。所以本人就在这里与大家分享一下直接导入的这种方式。
本程序也可以应用于ASP.NET中,那么下面的命名空间及一些地方就得改改了,还有要将程序都放于Page_Load中。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Xml;
namespace Read
{
public partial class Form1 : Form
{
XmlDocument xmldoc;
XmlNode xmlnode;
XmlElement xmlelem;
XmlElement xmlelem2;
double[,] tokens ={ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
public Form1()
{
InitializeComponent();
}
//先将TXT文档中数据转存到数组tokens中
private void btn_send_Click(object sender, EventArgs e)
{
string line;
 
相关文档:
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;namespace md5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(UserMd5("8"));
Console.WriteLine(GetMd5Str("8"));
}
/**//// <summary>
/// MD5 16位加密
......
非常简单,在C#中只需要在类的方法的上方敲三下"/"就自动帮你添加相关的代码,你只要按着填写就可以了,而Java则是输入"/**",它也会自动形成相关代码,具体代码如下:
C#
/// <summary>
/// 在此填写总体描述
///</summary>
/// <param name="name">这里填写参数name的描述</param>
public string ......
(一) 先讲一下XML中的物殊字符,手动填写时注意一下。
字符 字符实体
& &n ......
一些字符在 URL 或 XML 文档中使用时有特殊的含义,因此必须针对这些含义对字符做适当编码以使其生效。
URL 中的特殊字符
在 URL 上执行的查询中,特殊字符被指定为 %xx,其中 xx 是字符的十六进制值。下表列出了这些特殊字符并描述了它们的含义。有关更多信息,请参见 http://www.faqs.org/rfcs/rfc1738.html 中的 RFC ......
测试语法高亮的 C# 代码的 html fragment 生成:
用csdn blog API 发布.
下面是:
public class HtmlWriter
{
static Dictionary _colors;
static int _colorNum;
static StringBuilder _colorString;