SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    canada
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    looping this code.

    [CODE]
    Code:
    	Dim xml
    Dim teamA, teamB, scoreA, scoreB
    	Set xml = Server.CreateObject("Microsoft.XMLDOM")
    	xml.async = False
    	xml.load (Server.MapPath("/sportfeeds/week11.xml"))
    
    
    
    set nodes = xml.documentElement.selectSingleNode("game")
    		set childNode = nodes.childNodes
    		
    		for each childNodes in childNode
    			'Response.Write nodes.childNodes(1).text 'without the for loop
    			Response.Write childNodes.text
    		next

    it works perfectly, exactly like the way i want.
    my xml is setup so

    Code:
    <game>
        <teamA>
        <scoreA>
        <teamB>
        <scoreB>
    </game>
    <game>
        <teamA>
        <scoreA>
        <teamB>
        <scoreB>
    </game>
    <game>
        <teamA>
        <scoreA>
        <teamB>
        <scoreB>
    </game>
    the thing is that it only gets the FIRST node.. and i want it to loop to the next <game>.

    http://www.fakebets.net/sportfeeds/week11.xml

    look i made it work in http://www.fakebets.net/readsportpage.asp
    *ignore the marquee

    edit: yes there are closing tags. the xml is perfectly valid.

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    canada
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nvmd i got it.
    Code:
    	set allNodes = xml.documentElement.selectNodes("game")
    	for each node in allNodes
    		set childNode = node.childNodes
    		
    		for each childNodes in childNode
    			'Response.Write nodes.childNodes(1).text 'without the for loop
    			Response.Write childNodes.text
    			Response.Write ("<BR>") 
    		next
    		Response.Write ("<br><hr></br>")
    	next


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •