• 0

Javascript XML Parse


Question

I am trying to write a javascript parser that will grab data from an XML file. For example, here is the XML file I am trying to parse:

  <?xml version="1.0" encoding="UTF-8" ?> 
- <liveScoring week="1">
- <matchup>
  <franchise id="0001" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="0" /> 
  <franchise id="0005" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="1" /> 
  </matchup>
- <matchup>
  <franchise id="0006" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="0" /> 
  <franchise id="0007" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="1" /> 
  </matchup>
- <matchup>
  <franchise id="0004" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="0" /> 
  <franchise id="0008" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="1" /> 
  </matchup>
- <matchup>
  <franchise id="0010" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="0" /> 
  <franchise id="0011" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="1" /> 
  </matchup>
- <matchup>
  <franchise id="0009" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="0" /> 
  <franchise id="0002" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="1" /> 
  </matchup>
- <matchup>
  <franchise id="0012" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="0" /> 
  <franchise id="0003" score="0" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="1" /> 
  </matchup>
  </liveScoring>

How can I grab the values from the ID, Score, or any of the other attributes and display them on an HTML page?

Link to comment
https://www.neowin.net/forum/topic/477662-javascript-xml-parse/
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.