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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:11:29+00:00 2026-06-14T03:11:29+00:00

Is it possible to do a search for a key words in an exist-db

  • 0

Is it possible to do a search for a key words in an exist-db using xquery?

I’ve tried using

//foo//@val[. &= $param]

But this returns an error because this isn’t supported with my version of exist-db (1.4.2)

What is the best way to do a search over a number of nodes?

<xml>
   <foo @val='test1'>
   <bar @val='test2'>
       <thunk @val='test3'/>
   </bar>
   </foo>

So with my example XML, how can I do

let $result :=

if //xml/foo[contains(@val,$param)] or
//xml/foo/bar[contains(@val,$param)] or
//xml/foo/bar/thunk[contains(@val,$param)]

return $result
  • 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-14T03:11:30+00:00Added an answer on June 14, 2026 at 3:11 am

    Either of these should work:

    //foo//@val[contains(.,$param)]
    
    //foo//@val[. eq $param]
    

    However, there are obviously issues to consider when using contains() instead of equals. Also, if the paths will always be constrained as you describe in your example, and you are only checking to see if any of those are true (as opposed to actually getting all the elements), then this should be a faster and more efficient query:

    ((//xml/foo[@val eq $param])[1] or (//xml/foo/bar[@val eq $param])[1] or (//xml/foo/bar/thunk[@val eq $param])[1])
    

    Untested, but the [1] should short-circuit the xpath evaluator after it gets its first result from the query, and the ORs should short-circuit the expression when any one of them returns a value.

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

Sidebar

Related Questions

Is it possible to search on date ranges using Lucene in Java? How do
Is it possible to search the content of a std::ostringstream without using the std::ostringstream::str()
I know how to search for a repository by providing key words in Github
Possible Duplicate: How to sort the results of this code? Im making a search
I am using this class to highlight the search keywords on a piece of
Possible Duplicate: Search-like highlighting in NSTextView I thought i read here months ago that
Is it possible to search a string that is a regex, without escaping all
I am looking for a way (if possible) to search for apps from within
I have a question about IPTC metadata. Is it possible to search images that
Is it possible to find (search) in Dynamics AX 2009 for an exact match?

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.