www.webdeveloper.com
Results 1 to 2 of 2

Thread: Appending XML data to an existing HTML table.

Hybrid View

  1. #1
    Join Date
    Apr 2012
    Posts
    47

    Question Appending XML data to an existing HTML table.

    I'm very new to this. But I want to append data from an xml file into an existing HTML table...just the names and age. I have no idea how to do this. Here is my table code:
    HTML Code:
    <h1>The Seinfeld Family</h1>
    				<table id="Seinfeld Family" style="color:red; background-color:white; border-style:ridge;
    				             border-width:thick; border-color:Black; font-size:large; font-weight:bold;">
    					<tr id="Header"><th>First Name</th><th>Last Name</th><th>Age</th></tr>
    					<tr><td>George</td><td>Constanza</td><td>36</td></tr>
    					<tr><td>Jerry</td><td>Seinfeld</td><td>42</td></tr>
    					<tr><td>Krammer</td><td>Cosmo</td><td>44</td></tr>
    					<tr><td>Elaine</td><td>Benice</td><td>56</td></tr>
    					<tr><td>Larry</td><td>King</td><td>35</td></tr>
    					<tr><td>Bill</td><td>O'Reilly</td><td>56</td></tr>
    				</table>
    My XML Data:
    Code:
    <NewDataSet>
      <Tb_Supplier>
        <Supp_ID>1</Supp_ID>
        <FirstName>Joe</FirstName>
        <LastName>Houdini</LastName>
        <Age>29</Age>
        <City>Madison</City>
    </Tb_Supplier>
      <Tb_Supplier>
        <Supp_ID>2</Supp_ID>
        <FirstName>Jack</FirstName>
        <LastName>Herman</LastName>
        <Age>52</Age>
        <City>Madison</City>
    And my call to the XML file:
    Code:
     alert("XML as innerHTML");
    	    var destination;
    	    var responseObject;
    
    	    destination = document.getElementById("XMLDataSet");
    	    responseObject = MakeXMLHTTPCall("xml_dataset.XML");
    	    destination.innerHTML = responseObject.responseXML;
    Any help would be much appreciated.

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,136
    go to link it was written years ago, but hope this idea can help you. you did not mention where is XML data though. If its coming from server then there may be a different approach, however if xml data is with in the html then the link above will help you, or should help
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles