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

  • Home
  • SEARCH
  • 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 375277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:29:12+00:00 2026-05-12T14:29:12+00:00

I have the below fragement of XML, notice that the Reference node holds a

  • 0

I have the below fragement of XML, notice that the Reference node holds a URI which links to the Id attribute of the Body node.

 <Reference URI="#Body">
  <SOAP-ENV:Body Id="Body" xmlns:SOAP-ENV="http://www.dingo.org">
    <ns0:Add xmlns:ns0="http://www.moo.com">
      <ns0:a>2</ns0:a>
      <ns0:b>3</ns0:b>
    </ns0:Add>
  </SOAP-ENV:Body>

If I had the value of the URI attribute how would I then get the whole Body XMLNode? I presume this would be best done via an XPath epression but haven’t any clue on XPath. Note that the XML will not always be so simple. I’m doing this in c# btw 🙂

Any ideas?

Thanks

Jon

EDIT: I wouldn’t know the XML structure or namespaces before hand, all I would know is that the reference element has the ID of the xmlNode i want to retrieve, hope this is sligtly clearer.

  • 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-12T14:29:13+00:00Added an answer on May 12, 2026 at 2:29 pm

    You can add a condition that applies to a relative (or absolute node) to any step of an XPath expression.

    In this case:

    //*[@id=substring-after(/Reference/@URI, '#')]
    

    The //* matches all elements in the document. The part in [] is a condition. Inside the condition the part of the URI element of the root References node is taken, but ignoring the ‘#’ (and anything before it).

    Sample code, assuming you have loaded your XML into XPathDocument doc:

    var nav = doc.CreateNavigator();
    var found = nav.SelectSingleNode("//*[@id=substring-after(/Reference/@URI, '#')]");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to remove Component elements from the XML below that have File children
I have below a working query that needs to be simplified. The reason is
I have below is the html code for TD which gets appended after matching
So I have a sort of zigzag pattern, as shown below. , which is
I have created a custom dialog, the code is below. The problem is that,
I have the following simple XML fragment shown below. What would the T-SQL look
I have a loading image that works using the code below. It shows the
I have a xml fragment like below <Detail uid=6> <![CDATA[ <div class=heading>welcome to my
I have a vector class in C# (a fragment below). My issue is that
I am using Jquery. I have got below links in my html <a class=load-fragment

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.