How to select xml root node when root node has attribute?

前端 未结 3 376
故里飘歌
故里飘歌 2020-12-21 03:41

I am trying to select all the child nodes of root node of an xml document using XPath query.

My xml file looks something like following :



        
3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-21 04:22

    You can use GetElementsByTagName method below are the snippet of my code

    XmlDocument gazetteDocument = new XmlDocument();
    gazetteDocument.Load(xmlFilePath);
    XmlNodeList allNodes = gazetteDocument.GetElementsByTagName("root");
    

提交回复
热议问题