c# public static bool IsSelectNode(string xmlPath,string node){XmlDocument xmlDoc = new XmlDocument();xmlDoc.Load(xmlPath);XmlNode result = xmlDoc.SelectSingleNode(@"//" + node);return result = null;//就这行}
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 01:59:49
c# public static bool IsSelectNode(string xmlPath,string node){XmlDocument xmlDoc = new XmlDocument();xmlDoc.Load(xmlPath);XmlNode result = xmlDoc.SelectSingleNode(@"//" + node);return result = null;//就这行}
c#
public static bool IsSelectNode(string xmlPath,string node)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlPath);
XmlNode result = xmlDoc.SelectSingleNode(@"//" + node);
return result = null;//就这行
}
c# public static bool IsSelectNode(string xmlPath,string node){XmlDocument xmlDoc = new XmlDocument();xmlDoc.Load(xmlPath);XmlNode result = xmlDoc.SelectSingleNode(@"//" + node);return result = null;//就这行}
return result != null;
这行是反会是否获取到你的XML文档的判断!
如果没获取到文档那么result肯定为NULL,则result != null返回的就是false
如果获取到了那么result != null返回的就是true