日期:2014-05-19  浏览次数:20953 次

xpath取节点问题
string   xpath   =   "contains(string(name1), ' "   +   strKeys   +   " ') ";
XmlNodeList   nodes   =   doc.SelectNodes( "/alltickets/assort/ticket[ "   +xpath     +   "] ");  
ticket下有name1,name2,name3,name4四个节点,我只想取出name1,name3节点,怎么取啊?
如果XmlNodeList   nodes   =   doc.SelectNodes( "/alltickets/assort/ticket[ "   +xpath     +   "] ");   这样,四个节点都取出来了  
XmlNodeList   nodes   =   doc.SelectNodes( "/alltickets/assort/ticket[ "   +xpath     +   "]/name1 ");如果这样只取出name1节点.请指教!

------解决方案--------------------
恭喜,JF