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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:04:52+00:00 2026-06-03T20:04:52+00:00

Suppose this is my XML: <myxml> <data key=true>Apple</data> <data key=true>banana</data> <data1 key=true>banana</data1> <data>Apple</data> </myxml>

  • 0

Suppose this is my XML:

<myxml>
   <data key="true">Apple</data>
   <data key="true">banana</data>
   <data1 key="true">banana</data1>
   <data>Apple</data>
</myxml>

I need an XPath expression for the tag which contains attribute key="true" and node value = Apple.

I tried different combinations but not succeeded.

  • For attribute I use this xpath="/myxml/data[@key='true']
  • and for Node value I use this xpath = "/myxml/data[. ='Apple']/
  • and also try this xpath = "/myxml/data[.='Apple'][@key='true]/

but got error.

I have multiple tags in the xpath. /mappings/mapping[data[@iskey='true'][.='apple'] and data1[@iskey='true'][.='banana']/

There is a mistake in this path.

How I specify both the attribute and node value together ?

  • 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-06-03T20:04:54+00:00Added an answer on June 3, 2026 at 8:04 pm

    You need to use the ‘and’ operator.

    From your example:

        /myxml/data[.='Apple' and @key='true']
    

    Look under http://www.w3schools.com/xpath/xpath_operators.asp for more information on xpath operators.

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

Sidebar

Related Questions

Suppose I have this XML as a string: <calles> <calle> <nombre>CALLAO AV.</nombre> <altura>1500</altura> <longitud>-58.3918617027</longitud>
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
in my application i have this code: <Grid Name=BaseGrid> <Grid.Resources> <XmlDataProvider x:Name=ScenesXmlName x:Key=ScenesXml XPath=person
Suppose I have this XML: <x> <e s=1 t=A/> <e s=2 t=A/> <e s=1
Suppose I have this XML: <?xml version=1.0 encoding=UTF-8?> <root xmlns:foo=http://www.foo.com> <foo:one>Alpha</foo:one> <two foo:Dog=Yorkie>Bravo</two> <three>foo:Delta</three>
Suppose i have a xml file which has several nodes & children. I am
Suppose I have the following xml template: <?xml version=1.0 encoding=UTF-8 ?> <myXML> <params> <param
Suppose I this have this XML doc, where ... just represents other miscellaneous nodes:
I have the following XSLT question: Suppose I have this XML <items> <item> <type>dog</type>
Suppose i have an XML file, that i use as local database, like this):

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.