Reading a deep level xml tag with C#

rdwthgq

New Member
I need some help using Linq to xml, I've been reading online articles but still no luck, can anyone please help me out?I just need to read an xml file, the problem I'm having is that it has lots of sub levels and I haven't been able to access them.\[code\]<Dias> <Dia id="0"> <Restricciones> <Restriccion tipo="Ambiental" horaInicio="6" horaFin="10"> <Placas> <Placa>4</Placa> </Placas> </Restriccion> </Restricciones> </Dia></Dias>\[/code\]My current code is:\[code\]var dia = (int)DateTime.Now.DayOfWeek;var xElement = XElement.Load("Bogota.xml");var d = (from dias in xElement.Descendants("Dia")where dias.Attribute("id").Value =http://stackoverflow.com/questions/10918849/= dia.ToString()select dias).First();var rest = (from r in d.Descendants("Restricciones")select r);\[/code\]But I've tried several variations, but no luck so farCan someone help?
 
Back
Top