문제

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 ..).

도움이 되었습니까?

해결책

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);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top