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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:27:29+00:00 2026-06-10T02:27:29+00:00

So I am switching the graphML import method in one of my scripts and

  • 0

So I am switching the graphML import method in one of my scripts and I am having trouble cleaning up my imported data. Currently, the graphML data looks like this:

<node id="1">
  <data key="url">www.someURL.com</data> 
  <data key="label">Guy, This</data> 
  <data key="profile_url">/dir/uri=http...</data> 
  <data key="number_of_authored_works">x</data> 
  <data key="earliest_publication">y</data> 
  <data key="num_earliest_publication">z</data> 
  <data key="latest_publication">a</data> 
  <data key="num_latest_publication">b</data> 
  <data key="num_unknown_publication">c</data> 

Here is my code as it stands:

function loadXML() {
$.ajax({
    type: "GET",
    url: "Scripts/coauthor4.xml",
    dataType: "xml",
    success: xmlParser
})}

var someVar= [];
function xmlParser(xml) {

$(xml).find('edge').each(function (i) {
    someVar[i] = $(this).find('data').siblings().text();
})}

When I go to the console and ask for a node (someVar[i]), I get something like this:

www.someURL.comGuy, This/dir/uri=http...xyzabc

So I have all of the necessary data atleast…good. But I want to make key:value pairs out of each data point. So essentially, someVar[i][0] should be this:

someVar[i][0]
  url: 'www.someURL.com'
  • 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-10T02:27:30+00:00Added an answer on June 10, 2026 at 2:27 am

    Unless I’m missing something, you just need to toss another loop in there. Iterate through each ‘data’ node:

    $(xml).find('edge').each(function (i) {
        $(this).find('data').each(function(j) {
            var key = $(this).attr('key');
            someVar[i] = someVar[i] || {};
            someVar[i][key] = $(this).text();
        });
    });
    

    Now someVar[0] looks like:

    {
        url: 'www.someURL.com',
        label: 'Guy, This'
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently switching languages from Java(beginner) to c++ and would like to replicate
Does switching activities in Android start a fresh JVM? It seems like each activity
Switching from Microsofts Oracle Driver to ODP.NET version 10.2.0.100. After changing the data types
After switching to AS3, I've been having a hell of a time figuring out
I'm switching back and forth between Java and C# and one thing I miss
So I just started switching over from SDL to OpenGL today and I'm having
I am switching from the Django development server to Apache for production. To this
After switching from maven 2 to maven 3 I have found out having 0%
I'm interested in switching from Capistrano to Chef, but am having a few issues
Switching Byref to Byval on method calls I have many warnings raised due to:

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.