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 3607190
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:20:41+00:00 2026-05-18T21:20:41+00:00

I have a snippet of XML that looks like <body> Some text…. <nodeA>….</nodeA> more

  • 0

I have a snippet of XML that looks like

<body>
   Some text....
   <nodeA>....</nodeA>
   more text
   <someOtherNode>
      <nodeA>.......</nodeA>
   </someOtherNode>
   <nodeB>.......</nodeB>  
   etc.....
</body>

I’m selecting all nodeA and NodeB nodes inside <body> using an XPATH query similar to
//nodeA|//nodeB

As I understand it, .NET supports XPath 1.0 which does not guarantee node order.

How can I guarantee selected nodes are returned in document order in my OR query : that’s to say:

nodeA, nodeA, nodeB   
  • 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-18T21:20:41+00:00Added an answer on May 18, 2026 at 9:20 pm

    As I understand it, .NET supports
    XPath 1.0 which does not guarantee
    node order

    When an XPath 1.0 expression that selects nodes is evaluated, the selected nodes form a node-set. A node-set is a set and this, among many other things, means that it is unordered.

    For practical purposes, though, there is one main ordering chosen to enumerate the nodes of a node set: document order. In practice, all XPath 1.0 engines I know (and certainly in .NET) return the selected nodes in document order. In the future this is unlikely to change, because vendors try to preserve backwards compatibility.

    Therefore, just try using the SelectNodes() or Evaluate() methods and verify that the nodes in the results are in document order.

    Do note: The order of the following cannot be guaranteed and is implementation-dependent:

    1. Attributes of the same element.

    2. Nodes belonging to different documents (a node-set containing nodes from different documents can be produced using the XSLT function document(), so this most probably is of no concern to you).

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

Sidebar

Related Questions

I have a simple xml document that looks like the following snippet. I need
I have a snippet of an XML file that looks like: <?xml version=1.0 encoding=utf-16?>
I have a script snippet looks like below: <ItemGroup> <files Include=*.txt></files> </ItemGroup> <Message Text=@(files)>
I have a code snippet written in PHP that pulls a block of text
I have this xml snippet as part of a xml file that will be
I have some html that creates a dropdown list. The list has text values
I have a snippet of code that I'm working with to filter rows in
I have a JavaScript snippet that runs very well on Firefox and Safari, but
I have the following snippet where I would like to extract code between the
I have the following snippet of code that's generating the Use new keyword if

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.