Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1077995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:39:27+00:00 2026-05-16T21:39:27+00:00

I am trying to get both the next and previous elements of the current

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T21:39:28+00:00Added an answer on May 16, 2026 at 9:39 pm

    How about this:

    var previous = Current.PreviousNode;
    var next = Current.NextNode;
    

    The only issue with this is it will return comments and other things that are nodes, but based on your XML this would still work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i am trying get 2 div-containers which both should contain centered text (Both
I'm trying to get accustomed to both MFC development and Visual Studio so I
I'm trying to get the following code to work using both Watin and HttpWatch.
i am trying to get a search box to work on both click a
I'm trying to create two functions: get & set, that both accept an arbitrary
I'm trying to achieve two things, both of which I fail to get at.
So, I am trying to get these divs to lie next to each other,
I am trying to get next page of results from textSearch call using next_page_token
I'm trying to get multiple divs sitting next to each other, centered. When the
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.