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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:07:46+00:00 2026-05-15T18:07:46+00:00

stackoverflow newbie here, so I’m hoping you can give me a warm welcoe by

  • 0

stackoverflow newbie here, so I’m hoping you can give me a warm welcoe by helping me with a problem. I’ve found several questions and answers similar to this, but none that are exactly what I need.
I’m pulling in some XML via AJAX (jquery) that I would like to be able to filter using checkboxes, etc. similar to sites like this:
http://www.worldmarket.com/giftfinder/index.jsp

The XML isn’t formatted in the best way (which I have no control over), and looks similar to this for each element I pull in:

  <element text="something.exe" value="dev|something.exe" depth="0" lastUpdate="2010-03-09 09:50" nextUpdate="" category="Entertainment" filesize="2 MB">
    <attribute key="Description" value="here is the description"></attribute>
    <attribute key="Language" value="English,Russian,Ukrainian"></attribute>
    <attribute key="Function" value="History, Education"></attribute>
    <attribute key="Industry" value="Public Sector,Sports"></attribute>
    <attribute key="Title" value="Something"></attribute>
    <attribute key="Tags" value="Politics"></attribute>
  </element>

So I have no problem simply looping through and displaying all of the elements in a grid using code like this:

$(this).find("element").each(function(index){
var appTitle = $(this).find("attribute[key='Title']").attr("value") || $(this).attr("text");

But the problem I’m having is in filtering the tags. I want to have several checkboxes on the left which are associated with different tags (or the industry or function attributes) in the XML and when clicked have the result set filter to show only elements with those tags.
What is the best way to do this? It’s as if I want to add something to the .find() that says fine elements WHERE tags=… (I know that’s drifting into SQL land, but…)
Anyway, any help or direction will be GREATLY appreciated.
Thanks in advance!

Thanks again for you help.
I’ve tried using .has and so far can’t really get it to work. Even just testing it in general with the dummy data I listed above, it doesn’t work:

var testThisData = '<element text="something.exe" value="dev|something.exe" depth="0" lastUpdate="2010-03-09 09:50" nextUpdate="" category="Entertainment" filesize="2 MB"><attribute key="Description" value="here is the description"></attribute><attribute key="Language" value="English,Russian,Ukrainian"></attribute><attribute key="Function" value="History, Education"></attribute><attribute key="Industry" value="Public Sector,Sports"></attribute><attribute key="Title" value="Something"></attribute><attribute key="Tags" value="Politics"></attribute></element>';
console.log($(testThisData).has("attribute[key='Language'][value~='English']").length);`

returns 0 as does even this:

console.log($(testThisData).has("attribute").length);

Sorry, I think I’m just not getting something.
Thanks.

  • 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-15T18:07:47+00:00Added an answer on May 15, 2026 at 6:07 pm

    If you are looking to get all the elements with a “Language” of “English” for instance you should be able to use:

    $("element").has("attribute[key='Language'][value~='English']");
    

    You can chain the filters to get what you need. The above returns all element nodes that have key=”Language” and value containing English.
    If you need to get the English Language and Politics tag you can add another filter:

    $("element").has("attribute[key='Language'][value~='English']").has("attribute[key='Tags'][value~='Politics']")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm newbie to Android development. I'm having problem here and hope someone could help
This is my first post here in StackOverflow. I am not a newbie to
Sorry if the title sounds a bit vague. Stackoverflow posting newbie here. I have
stackoverflow forum member I am having some problem with a certain report designed using
Hello stackoverflow people! I've got a problem which I haven't been able to solve
stackoverflow. I'm a newbie at C++ and I've got one last issue with my
Newbie to StackOverflow as a poster, so please let me know if I violate
I am newbie in XML parsing world. I found solution for reading xml file
Newbie here, I am trying to use Bioperl module in the perl environment. My
This is my first question here on StackOverflow, and quite frankly I'm fairly new

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.