讀取xml檔案屬性的問題

2021-04-12 18:15:49 字數 639 閱讀 8009

///

/// 獲取menu----xml資訊

///

xmldocument xmldoc=new xmldocument();

xmldoc.load(xmlpath);//change this line

//訪問任意接點的子節點的屬性

//mydom.childnodes[i].attributes[i];

//get first element

xmlelement xmlroot=xmldoc.documentelement;

xmlnode node=xmlroot.selectsinglenode("//menugroup[@label=/"edit/"]");

if (node.haschildnodes)

{foreach(xmlnode xn in node.childnodes)

{nodestr += xn.name+":"+xn.innertext+"/r/n";

if (xn.attributes.count>0)

{for(int i=0;ithis.label2.text = nodestr;

附xml檔案

<?xml version="1.0" encoding="utf-8" ?>

vb 讀取檔案屬性

如果只是檢視大小 修改時間的話,可以直接使用vb內建函式 返回檔案位元組大小 filelen 檔案路徑 示例 private sub form load dim sout as string const sfile as string c windows notepad.exe sout 檔案路徑 ...

springboot讀取配置檔案屬性

比如xiao.zg.host 127.0.0.1 username xzg85586537 那麼就建立乙個檔案 data configurationproperties prefix xiao.zg 配置檔案的字首 public class xiaoproperties string host st...

物件讀取SpringBoot配置檔案屬性值

1.properties配置檔案屬性如下 2.實體類物件宣告 component configurationproperties prefix spring.redis 配置檔案中對應的字首 public class redisconfig public void setredishost stri...