var xml = XDocument.Parse(yourxmlstring, LoadOptions.None);
var resources= xml.Descendants("resources");
foreach (var resourceElement in resources.Descendants("Hotel"))
{
MessageBox.Show(resourceElement.Attribute("name").Value);
}
Get string form XML file by attribute
-
10-07-2023 - |
题
I have a XML file
<resources>
<string name="aaa">Hotel</string>
<string name="bbb">Home</string>
<string name="ccc">Castle</string>
...
<resourses>
I tried got content string (Hotel or Home ...) in using special name of this (aaa, bbb ..).
解决方案
不隶属于 StackOverflow