<?xml version="1.0"?>
<AppXmlLogWritter>
<LogData>
<LogID>5678201301161640382919</LogID>
<LogDateTime>20130114164038</LogDateTime>
</LogData>
<LogData>
<LogID>5678201301161640382920</LogID>
<LogDateTime>20130115154040</LogDateTime>
</LogData>
<LogData>
<LogID>5678201301161640382921</LogID>
<LogDateTime>20130116164042</LogDateTime>
</LogData>
</AppXmlLogWritter>
为了删除我在 xpath 查询下使用的一个节点
string xpathQuery = "/AppXmlLogWritter/LogData[LogDateTime ='" + txtToDate.Text.Trim() + "']";
XmlNodeList objxmlNodeList = objXmldoc.SelectNodes(xpathQuery);
for (int i = 0; i <= objxmlNodeList.Count - 1; i++)
{
objxmlNodeList[i].ParentNode.RemoveChild(objxmlNodeList[i]);
lblMessage.Text = "Record deleted sucessfully.";
}
我正在编写各种应用程序的 XML 文件的日志。用户可以在哪里删除 LogDateTime 范围之间的日志。我的 XPath 查询如何删除 LogDateTime 范围之间的日志。
示例:如果我必须删除日期时间范围 20130116164038 到 20130116164040 之间的日志。