SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: xml not showing

  1. #1
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xml not showing

    whats wrong with this, I've probably done something stupid any way, but let me know

    Code:
    <html>
    <head>
    
    <script type="text/javascript">
    
    	function test(field)
    	{
    		var row=field.rowIndex
    		xml_database.recordset.absoluteposition=row
    		cols.innerHTML=xml_database.recordset("COLORS")
    	}
    
    </script>
    
    </head>
    
    <body bgcolor="gray">
    
    <xml id="xml_database" src="colors.xml"></xml>
    
    <table border="1"  bgcolor="gray">
    
      <tr align="left">
        <th>name:</th><td id="cols"></td>
      </tr>
    
    </table>
    
    <table datasrc="#xml_database" border="1">
    
    <thead>
      <tr align="left">
        <th>color</th>
      </tr>
    </thead>
    
    <tr align="left">
      <td>
         <div datafld="COLORS">
      </td>
    </tr>
    
    </table>
    
    </body>
    </html>
    xml sheet
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <INFO>
    	<GROUP>
    		<COLORS>#0000ff</COLORS>
    		<COLORS>#0000cc</COLORS>
    		<COLORS>#000099</COLORS>
    		<COLORS>#000066</COLORS>
    		<COLORS>#000033</COLORS>
    		<COLORS>#000000</COLORS>
    	</GROUP>
    
    </INFO>

  2. #2
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no <XML> element in HTML. You'd have to rely on namespaces to do that, I think. I haven't played with XML very much and not at all for display, so if you're script's wrong there, then I can't really help you there. ;-)

    Anyway, are you just targeting IE6 or Mozilla?

    ~~Ian
    Last edited by Ian Glass; Apr 23, 2002 at 20:47.

  3. #3
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.w3schools.com/xml/tryit.a...cd_application

    this is what I want to make it similar to, but i want to store all colors in an xml file and display each link in the top table. basically i just need to display the contents of the xml file the javascript is fine after that. But the problem is the table does not show?

  4. #4
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML data island

    the code is fine... problem is with the xml...

    try altering your xml so that each parent tag only has one child called "colors"...like so...


    <?xml version="1.0" encoding="ISO-8859-1"?>
    <INFO>
    <GROUP>
    <COLORS>#0000cc</COLORS>
    </GROUP>
    <GROUP>
    <COLORS>#0000ff</COLORS>
    </GROUP>
    <GROUP>
    <COLORS>#000033</COLORS>
    </GROUP>
    </INFO>

    that would be my first guess anyway. my experience with xml is that its really unforgiving, everything has to be exactly right or you just dont get any results.

    let me know if it worked...
    Last edited by spartan; Apr 25, 2002 at 05:05.
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  5. #5
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it worked cheers spartan

    because i used replace all it added an extra tag which messed it up.


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
  •