forum

Home / DeveloperSection / Forums / how to retrieve attributes using LINQ

how to retrieve attributes using LINQ

Anonymous User 2645 09-Dec-2013

I am trying to get ALL attributes from "server" below:

This is the XML file(partial):

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<server xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" noNamespaceSchemaLocation="udsServerInfo.xsd" id="57672acc-4ba7-4876-811a-1629eca853ed" productPath="C:\Tools\UDS\udsServerInfo\" osActivated="true">
  <networkAdapters>
Here is the code which returns NULL for "server":
    var server = (from node in doc.Attributes("server")
                       select node);

I am able to get all networkAdapters by calling doc.Descendants("networkAdapter") but haven't figured out how to obtain the attributes .

Thank you


xml xml 
Updated on 10-Dec-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By