91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.25KB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2024-05-01
  • 語言: C#
  • 標簽: Xml??ML??操作??

資源簡介

實現了對xml文件的讀寫

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Web;
using?System.IO;
using?System.xml;
using?System.Data;

namespace?Phone
{
????///?
????///xmlProcess?的摘要說明
????///?

????public?class?xmlProcess
????{
????????public?xmlProcess()
????????{
????????????//
????????????//TODO:?在此處添加構造函數邏輯
????????????//
????????}
????????public?xmlProcess(string?strPath)
????????{
????????????this._xmlPath?=?strPath;
????????}
????????private?string?_xmlPath;
????????public?string?xmlPath
????????{
????????????get?{?return?this._xmlPath;?}
????????}


????????///?
????????///?導入xml文件
????????///?

????????///?lPath“>xml文件路徑
????????///?
????????private?xmlDocument?xmlLoad()
????????{
????????????string?xmlFile?=?xmlPath;
????????????xmlDocument?xmldoc?=?new?xmlDocument();
????????????try
????????????{
????????????????string?filename?=?AppDomain.CurrentDomain.baseDirectory.ToString()?+?xmlFile;
????????????????if?(File.Exists(filename))
????????????????????xmldoc.Load(filename);
????????????}
????????????catch?(Exception?e)
????????????{
????????????????throw?e;
????????????}
????????????return?xmldoc;
????????}


????????///?
????????///?導入xml文件
????????///?

????????///?lPath“>xml文件路徑
????????///?
????????private?static?xmlDocument?xmlLoad(string?strPath)
????????{
????????????xmlDocument?xmldoc?=?new?xmlDocument();
????????????try
????????????{
????????????????string?filename?=?AppDomain.CurrentDomain.baseDirectory.ToString()?+?strPath;
????????????????if?(File.Exists(filename))
????????????????????xmldoc.Load(filename);
????????????}
????????????catch?(Exception?e)
????????????{
????????????????throw?e;
????????????}
????????????return?xmldoc;
????????}


????????///?
????????///?讀取指定節點的數據
????????///?

????????///?節點
????????///?string
????????/**************************************************
?????????*?使用示列:
?????????*?xmlProsess.Read(“/Node“?““)
?????????*?xmlProsess.Read(“/Node/Element[@Attribute=‘Name‘]“)
?????????************************************************/
????????public?string?Read(string?node)
????????{
????????????string?value?=?““;
????????????try
????????????{
????????????????xmlDocument?doc?=?xmlLoad();
????????????????xmlNode?xn?=?doc.SelectSingleNode(node);
????????????????value?=?xn.InnerText;
????????????}
????????????catch?(Exception?e)?
????????????{
????????????????throw?e;
????????????}
????????????return?value;
????????}


????????///?
????????///?讀取指定路徑和節點的串聯值
????????///?

????????///?路徑
????????///?節點
????????///?屬性名,非空時返回該屬性值,否則返回串聯值
????????///?string
????????/********

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????16307??2020-03-03?15:11??xmlProcess.cs

-----------?---------??----------?-----??----

????????????????16307????????????????????1


評論

共有 條評論