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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:38:10+00:00 2026-06-16T17:38:10+00:00

I have a big xml document that i’m trying to process into an array

  • 0

I have a big xml document that i’m trying to process into an array in javascript.

<DR>
   <C>
     <SWDGDRC>
       <CID>0</CID>
       <V>06/01/2012 00:00:00</V>
     </SWDGDRC>
     <SWDGDRC>
       <CID>1</CID>
       <V>1131</V>
     </SWDGDRC>
     <SWDGDRC>
       <CID>2</CID>
       <V>28800</V>
     </SWDGDRC>
   </C>
   <rowid>0</rowid>
</DR>
<DR>
   <C>
     <SWDGDRC>
       <CID>0</CID>
       <V>06/02/2012 00:00:00</V>
     </SWDGDRC>
     <SWDGDRC>
       <CID>1</CID>
       <V />
     </SWDGDRC>
     <SWDGDRC>
       <CID>2</CID>
       <V />
     </SWDGDRC>
   </C>
   <rowid>1000</rowid>

It consists of multiple DR(datarow) and each DR has multiple C (columns) and a rowid.
I’m trying to loop all this data into an associative array:

    for(var i=0; i < DR.length; i++) {          // loop DR
        for(var j=0; j < DR[i].getElementsByTagName('C').length; j++) {    // loop C
            for(var k=0; k < DR[i].getElementsByTagName('C')[j].getElementsByTagName('SWDGDRC').length; k++) {   //loop SWDGDRC
                columnData[i] = {
                    "rowid": DR[i].getElementsByTagName('rowid')[0].textContent,
                    "column": {
                       columnID: DR[i].getElementsByTagName('C')[j].getElementsByTagName('SWDGDRC')[k].getElementsByTagName('CID')[0].textContent,
                       value:DR[i].getElementsByTagName('C')[j].getElementsByTagName('SWDGDRC')[k].getElementsByTagName('V')[0].textContent
                    }
               };
            }
        }
    }

The problem is I want to make an new array in the “column” key which loops all the C (columns) data so I can access this data using something like this: columnData[0][‘column’][0][‘columnID’]

  • 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-16T17:38:12+00:00Added an answer on June 16, 2026 at 5:38 pm
    for(var i=0; i < DR.length; i++) {          // loop DR
            for(var j=0; j < DR[i].getElementsByTagName('C').length; j++) {    // loop C
                columnData[i] = new Array(DR[i].getElementsByTagName('C')[j].getElementsByTagName('SWDGDRC').length);
                columnData[i] = {
                    rowid: DR[i].getElementsByTagName('rowid')[0].textContent
                }
                for(var k=0; k < DR[i].getElementsByTagName('C')[j].getElementsByTagName('SWDGDRC').length; k++) {   //loop SWDGDRC
                    columnData[i][k] = {
                        columnID: DR[i].getElementsByTagName('C')[j].getElementsByTagName('SWDGDRC')[k].getElementsByTagName('CID')[0].textContent,
                        value:DR[i].getElementsByTagName('C')[j].getElementsByTagName('SWDGDRC')[k].getElementsByTagName('V')[0].textContent
                    };
                }
            }
        }
    

    Fixed it by using the previous code. First I create a new array with the length of the array that i’m going to loop then I set the ‘rowid’ field. This way I can access my data by: columnData[0][0][‘columnID’]

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

Sidebar

Related Questions

I have a big xml document that looks like this: <Node name=foo> <Node name=16764764625>
So I am provided a big XML document. I have to write a query
We have a bog-standard javax.xml.* parser that slurps up a big XML file and
I've got a fairly big XML file that I need to parse into a
I have a big xml file that I want to get transferred from c:
I have an xml sitemap structured like a document tree, such that it looks
I'd like to make an XML document in JavaScript then have a save dialog
I have a big XML file (~20 MB) that contains among others such lines:
I have a quite big XML output from an application. I need to process
I have a 30MB big XML files and want to find a couple of

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.