Parse XDocument without having to keep specifying the default namespace

前端 未结 5 1702
北荒
北荒 2021-02-13 16:51

I have some XML data (similar to the sample below) and I want to read the values in code.

Why am I forced to specify the default namespace to access each element? I woul

5条回答
  •  后悔当初
    2021-02-13 17:24

    This is how the Linq-To-Xml works. You can't find any element, if it is not in default namespace, and the same is true about its descendants. The fastest way to get rid from namespace is to remove link to the namespace from your initial XML.

提交回复
热议问题