Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    48
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Table not showing??

    I'm doing a simple xml for for a wii database and now my table is not appearing on screen??

    Here's my code

    xmltest.html
    Code:
    <html>
    <head>
    
    <script type="text/javascript">
    var xmlDoc;
    if (window.ActiveXObject)
    {// code for IE
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    }
    else if (document.implementation.createDocument)
    {// code for Mozilla, Firefox, Opera, etc.
    xmlDoc=document.implementation.createDocument("","",null);
    }
    else
    {
    alert('Your browser cannot handle this script');
    }
    xmlDoc.async=false;
    xmlDoc.load("file:///C:/Users/Mike/Desktop/wiicat.xml");
    
    var x=xmlDoc.getElementsByTagName("CD");
    
    function show(i)
    {
    artist=(x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
    title=(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
    year=(x[i].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue);
    country=(x[i].getElementsByTagName("COUNTRY")[0].childNodes[0].nodeValue);
    company=(x[i].getElementsByTagName("COMPANY")[0].childNodes[0].nodeValue);
    price=(x[i].getElementsByTagName("PRICE")[0].childNodes[0].nodeValue);
    
    txt="Artist: "+artist+"<br />Title: "+title+"<br />Year: "+year+"<br />Country: "+country+"<br />Company: "+company+"<br />Price: "+price  ;
    
    document.getElementById("show").innerHTML=txt;
    }
    </script>
    <style type="text/css">
    <!--
    .style1 {
    	font-family: "Times New Roman", Times, serif;
    	font-size: 16px;
    	color: #003399;
    }
    body,td,th {
    	color: #000000;
    }
    body {
    	background-color: #FFFFFF;
    	background-image: url(wii.jpg);
    	background-repeat: no-repeat;
    }
    .style3 {
    	color: #000000;
    	font-size: xx-large;
    }
    -->
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    
    <body>
    <div align="justify"></div>
    <div class="style1" id='show'>
      <div align="center" class="style3">CLICK ON A ROW TO DISPLAY GAME INFO</div>
    </div>
    <div align="center"><br />
    </div>
    <p align="center" class="style1">
      <script type="text/javascript">
    document.write("<table border='1'>");
    for (var i=0;i<x.length;i++)
    { 
    document.write("<tr onclick='show(" + i + ")'>");
    document.write("<td>");
    document.write(x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
    document.write("</td>");
    
    document.write("<td>");
    document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
    document.write("</td>");
    document.write("</tr>");
    }
    document.write("</table>");
      </script>
    </p>
    </body>
    </html>
    wiicat.xml

    Code:
    <CATALOG>
    
    <CD>
    <TITLE>The Golden Compass</TITLE>
    <ARTIST>SEGA</ARTIST>
    <COUNTRY>PAL</COUNTRY>
    <COMPANY>Sega</COMPANY>
    <PRICE>55</PRICE>
    <YEAR>2008</YEAR>
    </CD>
    
    <CD>
    <TITLE>Super Mario Galaxy</TITLE>
    <ARTIST>Wii</ARTIST>
    <COUNTRY>PAL</COUNTRY>
    <COMPANY>Nintendo</COMPANY>
    <PRICE>45/PRICE>
    <YEAR>2007</YEAR>
    </CD>
    
    </CATALOG>
    Any help to get my table to appear would be great!

  • #2
    Regular Coder fishluvr's Avatar
    Join Date
    Nov 2005
    Posts
    110
    Thanks
    1
    Thanked 12 Times in 12 Posts
    Typo in your XML.

    <PRICE>45</PRICE>
    ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>`·.¸¸.·´¯`·.¸¸.·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>

  • Users who have thanked fishluvr for this post:

    mikebyrne (12-12-2008)

  • #3
    New Coder
    Join Date
    Dec 2007
    Posts
    48
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thanks alot! (It was driving me mental)


  •  

    Posting Permissions

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