0

Kind of new to XML Parsing and Javascript in general, wondering how to parse through the xml below using javascript. I essentially want to access each node and save all the information. I know I can do a for loop, but I can not figure out how to do it.

I'm using a parse database, I'll be accessing it through HTTPRequest. I'll be saving back to parse. I want to pull the information out of the StateCrossword node, then go to the game node and extract its attributes, then go to nodes within it, then go to the next StateCrossword loop.

<allcrosswords>
  <StateCrossword UserId="223943">
    <game game_name="History CrossWord">
      <crossword_date_played>02/01/2014</crossword_date_played>
      <words_wrong>2</words_wrong>
      <total_score>110</total_score>
    </game>
  </StateCrossword>
  <StateCrossword UserId="4894734">
    <game game_name="Sports Crossword">
      <crossword_date_played>04/16/2015</crossword_date_played>
      <words_wrong>10</words_wrong>
      <total_score>12</total_score>
    </game>
  </StateCrossword>
  <StateCrossword UserId="6092735">
    <game game_name="Movies Crossword">
      <crossword_date_played>08/04/2014</crossword_date_played>
      <words_wrong>12</words_wrong>
      <total_score>0</total_score>
    </game>
  </StateCrossword>
</allcrosswords>

Any help would seriously be greatly appreciated! Thanks!

Ahmet Emre Kilinc
  • 5,489
  • 12
  • 30
  • 42
James Jones
  • 572
  • 1
  • 6
  • 17

0 Answers0