XML樣例:
<?xml version="1.0" encoding="gb2312"?> <bookstore> <book genre="李1" ISBN="2-3645-4"> <title>Net從入門到精通</title> <author>李大蒜</author> <price>58.3</price> </book> <book genre="李2" ISBN="2-3631-4"> <title>CS從入門到精通</title> <author>候捷</author> <price>58.3</price> </book> <book genre="李3" ISBN="2-3631-4"> <title>CS從入門到精通</title> <author>候捷</author> <price>58.3</price> </book> </bookstore>
執行代碼一:
/// <summary> /// 刪除屬性值等於“AttributeValue”的節點 /// </summary> /// <param name="xmlFileName">XML文檔完全文件名(包含物理路徑)</param> /// <param name="xpath">要匹配的XPath表達式(例如:"//節點名//子節點名</param> /// <param name="xmlAttributeName">要刪除包含xmlAttributeName屬性的節點的名稱</param> /// 查看本欄目