I am trying to get both the next and previous elements of the current element
Here is the xml
<template id="9">
<tabs>
<tab>
<name>test</name>
<description />
</tab>
<tab>
<name>test3</name>
<description />
</tab>
<tab>
<name>test7</name>
<description />
</tab>
</tabs>
<tabs />
<tabs />
</template>
The current node is the tab with
test3
here is the code i am using
var doc = XDocument.Parse(q.XMLtext);
var tabs = doc.ElementOrDefault("template").ElementOrDefault("tabs").Elements();
var Current = doc.ElementOrDefault("template")
.ElementOrDefault("tabs")
.ElementsOrDefault("tab")
.ElementsOrDefault("name")
.Where(x => x.Value == name);
//get the next and previous nodes here