Can't use Descendants() or Elements() with xmlns

后端 未结 3 1912
执笔经年
执笔经年 2021-01-04 11:52

I\'m new to working with XML, and I\'ve encountered a weird problem while trying to get a specific tag from a spring.net configuration file. After trying to narrow down the

3条回答
  •  难免孤独
    2021-01-04 12:19

    You need to search for tags in that namespace:

    XNamespace ns = "aaa";
    
    xmlFile.Descendants(ns + "B").ToList()
    

提交回复
热议问题