C# Linq to Sql XML Retrieve Closest Element in Parent

GerladS

New Member
I have some wonky XML I'm trying to read values from.\[code\]<text> <term>a</term> <line> <elm>data here</elm> </line> <term>b</term> <line> <elm>data here</elm> </line> <term>c</term> <line> <elm>data here</elm> </line></text>\[/code\]I only have access to the the 3 \[code\]line\[/code\] elements at this point. As I loop over each line, for the first line I want to find the element \[code\]term\[/code\] that happens to have "a" as a value since it's the "closest" to the first line child. Same thing for the second line except I want to find the closest \[code\]term\[/code\] element, which in this case is "b"How can I accomplish this reliably using LINQ?
 
Back
Top