XDocument.Descendants not returning descendants

前端 未结 4 1682
暗喜
暗喜 2020-12-17 07:41



        
4条回答
  •  情话喂你
    2020-12-17 08:23

    You have to use the namespace:

    // do _not_ use   var ns = ... here.
    XNameSpace ns = "http://www.lge.com/ddc";
    
    foreach (XElement element in xdoc.Descendants(ns + "nationalList")
    {
          MessageBox.Show(element.ToString());
    }
    

提交回复
热议问题