xml|xml C#操作XML初步(8)
第四章:通用的XML處理方法(2)
上一篇,我們提供了一個類,用來操作XML檔案,這裡提供一個應用的例子,來源於無聊時候寫的一個XML留言本中對留言資料的處理
代碼如下: using System;
using System.IO;
using System.Data;
using System.Diagnostics;
using XmlBook.Com.Sem.Tools; //這裡就包含了上一篇提供的類
namespace XmlBook.Component
{
/// <summary>
/// 著作權: Copyright by SEM IT Department
/// 版本: 0.0.1
/// 檔案: XmlBook.Component.MdlDataMange.cs
/// 目的: 留言資料相關的操作
/// 作者: 歐遠寧 @2005-04-09
/// 郵箱: outrace@soueast-motor.com
/// 修改:
/// </summary>
public class MdlDataManage
{
#region 私人成員
private string strID = null;
private string strName = null;
private string strSex = null;
private string strEmail = "no email";
private string strPage = "no page";
private string strQQ = "no QQ";
private string strSubject = null;
private string strContent = null;
private string strReply = "no reply";
private string strFilter = null;
#endregion
#region 公有成員
/// <summary>
/// 姓名
/// </summary>
public string StrName
{
get{return this.strName;}
set{this.strName = value;}
}
/// <summary>
/// 性別
/// </summary>
public string StrSex
{
get{return this.strSex;}
set{this.strSex = value;}
}
/// <summary>
/// 郵箱
/// </summary>
public string StrEmail
{
get{return this.strEmail;}
set{this.strEmail = value;}
}
/// <summary>
/// 首頁
/// </summary>
public string StrPage
{
get{return this.strPage;}
set{this.strPage = value;}
}
/// <summary>
/// OICQ號碼
/// </summary>
public string StrQQ
{
get{return this.strQQ;}
set{this.strQQ = value;}
}
/// <summary>
/// 主題
/// </summary>
public string StrSubject
{
get{return this.strSubject;}
set{this.strSubject = value;}
}
/// <summary>
/// 內容
/// </summary>
public string StrContent
{
get{return this.strContent;}
set{this.strContent = value;}
}
/// <summary>
/// 回複
/// </summary>
public string StrReply
{
get{return this.strReply;}
set{this.strReply = value;}
}
/// <summary>
/// ID號
/// </summary>
public string StrID
{
get{return this.s