XML:Как разбирать строку xml, используя linq для xml?
<shift_details>
<shift_time>10:00 to 10:30</shift_time>
<count>0</count>
<shift_time>10:30 to 11:00</shift_time>
<count>0</count>
<shift_time>11:00 to 11:30</shift_time>
<count>0</count>
<shift_time>11:30 to 12:00</shift_time>
<count>0</count>
<shift_time>12:00 to 12:30</shift_time>
<count>0</count>
</shift_details>
Код:
var slots = from c in xmlResponse.Descendants("shift_details")
select new TimeSlots
{
time = (string)c.Element("shift_time"),
count = (string)c.Element("count"),
};
выше код возврата только один слот элемент в качестве выходного .Но мой XML содержит слишком много записей.
Как читать все записи в приведенном выше xml?
Я полагаю, вы имеете в виду linq для xml – Jonesopolis
Если вы контролируете структуру XML, я бы изменил XML, потому что он не структурирован правильно –