问题网址两个一起给分。

解决方案 »

  1.   

    用xml的方法就行了。
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(Server.MapPath("~/test.xml"));
            XmlNode url = xmlDoc.SelectSingleNode(@"//url[loc='http://localhost:2673/clientWeb/test/AboutUs.html']");
            url.ParentNode.RemoveChild(url);
            xmlDoc.Save(Server.MapPath("~/test.xml"));
      

  2.   

    XDocument doc = XDocument.Load("input.xml");
    var q = from node in doc.Descendants("url")
            let attr = node.Attribute("loc")
            where attr != null && attr.Value == ""
            select node;
    q.ToList().ForEach(x => x.Remove());
    doc.Save("output.xml");
      

  3.   

    如果xml是
    <sitemap xmlns="">
        <loc>http://localhost:2673/SiteMap_Google.xml</loc>
        <lastmod>2012-10-26</lastmod>
      </sitemap>的  (@"//url[loc='http://localhost:2673/clientWeb/test/AboutUs.html']")该怎么写?
    (@"//sitemap[loc='http://localhost:2673/clientWeb/test/AboutUs.html']") 是不是这样?