Я хочу, чтобы найти XML, который имеет атрибут раздел Мой код контроллера:Рассмотрим тег, который имеет атрибут в XML
xd.LoadXml(p.text);
XmlNodeList txt = xd.GetElementsByTagName("Texts");
for (int i = 0; i < txt.Count; i++)
{
XmlNode nd = txt.Item(i);
if (nd.HasChildNodes)
{
XmlNodeList cnd = nd.ChildNodes;
foreach (XmlNode n in cnd)
{
if (SectionName == n.Attributes["section"].Value)
{
Text text = new Text()
{
AudioList = n.Attributes["audio"].Value
};
newroom.text.Add(text);
}
}
}
}
и XML, как:
<Texts>
<Text group="Outbuilding0">blank</Text>
<Text group="Study0" audio="abc.wav" section="Walls and skirting">[[Walls and skirting]] </Text>
<Text group="Study0" audio="c.wav" section="Walls and skirting">[[Walls and skirting]] </Text>
</Texts>
Поиск только из которых имеет атрибут раздела .. любое предложение plz?
Что такое атрибут 'audio'? Те, у которых атрибуты 'section' в вашем примере не имеют этого. –
Я удалил его..Но я обновил @CharlesMager –