xml結構如下:
<?xml version="1.0" encoding="utf-8" ?>
c:\users\desktop\機台資料\eventdata.txt
sa5r22eb-27b4-48d7-9de9-c9df6ddf61af
1c:\users\desktop\機台資料\eventdata.txt
urh672eb-27b4-48d7-9de9-c9df6ddf61af
1c:\users\desktop\機台資料\eventdata.txt
adf672eb-27b4-48d7-9de9-c9df6ddf61af
1
解析方法如下:
private listreadxmlinfo()
//讀取指定節點
//xmlnode xmlnode = xmldoc.selectsinglenode("//connectionstrings");
檔案路徑
//file = xmlnode.selectsinglenode("file").innertext;
線體//line = xmlnode.selectsinglenode("line").innertext;
機台號//machineplatno = xmlnode.selectsinglenode("machineplatno").innertext;
return machinfos;
}catch (exception e)
}
/// /// 獲取路徑配置
///
///
public string getsmtpath()
catch
return path;
}/// /// 讀取指定節點的值(innertext)
///
/// 節點名稱
///
private string getxmlnodevalue(string strnode)
xmldoc.load(path);
string strreturn = string.empty;
trycatch (xmlexception xmle)
return strreturn;
}//xml檔案格式格式
<?xml version="1.0" encoding="utf-8"?>
04558
張三2019/12/20 11:40:54
c:\users\desktop\test1.log
C 讀取xml檔案
2.將tinyxml檔案目錄下的tinystr.h tinystr.cpp tinyxml.h tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp等放入工程目錄下 3.使用的xml範例如下 book store book1 book2 4.讀取 如下 a 申...
C 讀取大型Xml檔案
這篇部落格將介紹在c 中如何讀取資料量很大的xml檔案。請看下面的xml檔案,xml version 1.0 encoding utf 8 catalog book id bk101 author gambardella,matthew author title c developer title ...
讀取XML檔案
private void button2 click object sender,eventargs e using filestream fs new filestream filename,filemode.open,fileaccess.read n xl.name 是否有屬性 if xl.h...