I´ve got a class called "server
" with all attributes. I want to fill in the data from each node/element into the class.
The only way I know is foreach and than everytime a big switch-case. This can´t be the best way!
Here the XML-File:
<serverData .....>
<name>...</name>
<number>...</number>
<language>de</language>
<timezone>...</timezone>
<domain>...</domain>
<version>...</version>
...
</serverData>
The XML-File is from an API and I get it with this lines:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(Request.request(URL));
And now I want do something like (no real code just an example):
Server server = new Server();
server.name = xmlDoc.node["name"].Value;
server.version = ...
...
Thank you for your solution.