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

The Archive Base Latest Questions

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

I am currently developing a HTML game whereby a user drags items and drops

  • 0

I am currently developing a HTML game whereby a user drags items and drops them into their correct categories. The categories and their items are defined in an XML document.

My XML format:

<config>
<game>
    <title>Dementia</title>
        <cat>
            <catTitle>Mild</catTitle>
            <item>mild-1</item>
            <item>mild-2</item>
            <item>mild-3</item>
        </cat>
        <cat>
            <catTitle>Moderate</catTitle>
            <item>Moderate-1</item>
            <item>Moderate-2</item>
            <item>Moderate-3</item>
        </cat>
        <cat>
            <catTitle>Severe</catTitle>
            <item>Severe-1</item>
            <item>Severe-2</item>
        </cat>
</game>

I want to parse this XML file using jQuery into seperate arrays based on their category.

So for example:

array1 = [mild-1,mild-2,mild-3]

array2 = [Moderate-1,Moderate-2,Moderate-3] etc…

This would allow me to check if the dropped item’s attribute is correct based on the category array.

If you have any other ideas of how this could be done please do suggest.

Thank you in advance.

  • 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-11T03:04:35+00:00Added an answer on June 11, 2026 at 3:04 am

    Try, something like this:

    $(document).ready(function() {
        var arr = [];
        $(xml).find("cat").each(function(idx, v) {
            arr[idx] = [];
            $(v).find("item").each(function( i , vi) {
                arr[idx].push( $(vi).text() );
            });             
        });
        console.log( arr );
    });
    

    Will return response like:

    [
        ["mild-1", "mild-2", "mild-3"]
    , 
        ["Moderate-1", "Moderate-2", "Moderate-3"]
    , 
        ["Severe-1", "Severe-2"]
    ]
    

    So you can access individual array as,

    console.log( arr[0] ); //for first, and so on..
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a TDD idmb html scraper which ill extract certain fields from
Currently developing a PHP framework and have ran into my first problem. I need
I'm currently developing my first android app, and my first game. I've been developing
I'm currently developing a webtool for a game called 'Eve Online'. This game has
I'm currently developing a web application and have run into a little problem. I'm
I'm developing a content uploading tool that is currently GETing the html data in
I'm new to developing, currently only developed on web, like php,html,css,javascript etc etc. Any
I am currently building the HTML and CSS for an application I am developing.
I'm developing a growl like notifications for my site, currently it's like this: HTML:
I am currently developing a game for mobile phones using the Unity Engine. We

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.