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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:40:16+00:00 2026-05-30T09:40:16+00:00

I’m not sure how to explain this, so if there’s a better way please

  • 0

I’m not sure how to explain this, so if there’s a better way please let me know.

I have a value that I need to search the XML For, but I want to search for another value before I get my result set.

Let me show you:

<n:TaskGetResponse>
    <MemHead>
        <memidnum>1262753194</memidnum>
        <memrecno>22672100</memrecno>
    </MemHead>
    <MemHead>
        <memidnum>1262753194</memidnum>
        <memrecno>22672104</memrecno>
    </MemHead>
    <EntXtsk>
        <caudrecno>6348855</caudrecno>
        <memrecno>22672100</memrecno>
    </EntXtsk>
    <EntXtsk>
        <caudrecno>6348855</caudrecno>
        <memrecno>22672101</memrecno>
    </EntXtsk>
    <EntXtsk>
        <caudrecno>6348878</caudrecno>
        <memrecno>22672102</memrecno>
    </EntXtsk>
    <MemXtsk>
        <caudrecno>6348878</caudrecno>
        <memrecno>22672103</memrecno>
    </MemXtsk>
</n:TaskGetResponse>

I have the memidnum of 1262753194. I want to find All EntXtsk and MemXtsk that have a memrecno that matches all MemHead’s that have a memidnum of 1262753194.

In this example I have 2 MemHeads that have the same memidnum, but different memrecno (there are 2 memrecno’s to look at). I want to find all *Xtsk that have a memrecno that match the 2.

Is this possible with XPath?

Using

TaskGetResponse/*[name(.) = 'MemXtsk' or name(.) = 'EntXtsk']

I can get all the *Xtsk nodes.

But not sure how to get the ones only associated with the memidnum->memrecno that I need.

Any help would rock.

Update:
I can run

TaskGetResponse/*[memrecno= //TaskGetResponse/*[memidnum="1262753194"]/memrecno]

And that gets me everything with that memrecno combination. But I’m not sure how to say only get me EntXtsk and MemXtsk.

  • 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-30T09:40:17+00:00Added an answer on May 30, 2026 at 9:40 am

    Use:

    /*/*[self::EntXtsk or self::MemXtsk]
          [memrecno
          =
           /*/MemHead[memidnum = 1262753194]/memrecno
           ]
    

    This selects any element named EntXtsk or MemXtsk, that is a child of the top element of the XML document, and that has a memrecno child, whose string value is equal to the string value of some memrecno element that is a child of a MemHead element that is a child of the top element in the XML document and that also has a memidnum child whose string value is "1262753194"

    XSLT – based verification (I strongly recommend using the XPath Visualizer for any XPath exploration):

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="/">
      <xsl:copy-of select=
       "/*/*[self::EntXtsk or self::MemXtsk]
              [memrecno
              =
               /*/MemHead[memidnum = 1262753194]/memrecno
               ]
       "/>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on this XML document (the provided one with added one more MemXtsk element at the end):

    <n:TaskGetResponse xmlns:n="n">
        <MemHead>
            <memidnum>1262753194</memidnum>
            <memrecno>22672100</memrecno>
        </MemHead>
        <MemHead>
            <memidnum>1262753194</memidnum>
            <memrecno>22672104</memrecno>
        </MemHead>
        <EntXtsk>
            <caudrecno>6348855</caudrecno>
            <memrecno>22672100</memrecno>
        </EntXtsk>
        <EntXtsk>
            <caudrecno>6348855</caudrecno>
            <memrecno>22672101</memrecno>
        </EntXtsk>
        <EntXtsk>
            <caudrecno>6348878</caudrecno>
            <memrecno>22672102</memrecno>
        </EntXtsk>
        <MemXtsk>
            <caudrecno>6348878</caudrecno>
            <memrecno>22672103</memrecno>
        </MemXtsk>
        <MemXtsk>
            <caudrecno>6348879</caudrecno>
            <memrecno>22672104</memrecno>
        </MemXtsk>
    </n:TaskGetResponse>
    

    evaluates the XPath expression and copies to the output the selected nodes:

    <EntXtsk xmlns:n="n">
       <caudrecno>6348855</caudrecno>
       <memrecno>22672100</memrecno>
    </EntXtsk>
    <MemXtsk xmlns:n="n">
       <caudrecno>6348879</caudrecno>
       <memrecno>22672104</memrecno>
    </MemXtsk>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I have thousands of HTML files to process using Groovy/Java and I need to
I have some data like this: 1 2 3 4 5 9 2 6

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.