360haven works best with JavaScript enabled
Add HTML to XML Data
Loading
Register
Results 1 to 2 of 2
  1. #1
    DEADBEEF

    JizzaBeez is offline
    Join Date : Nov 2010
    Posts : 777
    Array

    Add HTML to XML Data

    Add HTML to XML Data

    In the following example, we loop through an XML file ("cd_catalog.xml"), and display the contents of each CD element as an HTML table row:
    Example

    Code:
    <html>
    <body>
    
    <script type="text/javascript">
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.open("GET","cd_catalog.xml",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML; 
    
    document.write("<table border='1'>");
    var x=xmlDoc.getElementsByTagName("CD");
    for (i=0;i<x.length;i++)
      { 
      document.write("<tr><td>");
      document.write(x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
      document.write("</td><td>");
      document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
      document.write("</td></tr>");
      }
    document.write("</table>");
    </script>
    
    </body>
    </html>
    Try it yourself

  2. The Following 2 Users Say Thank You to JizzaBeez For This Useful Post:


  3. #2
    JohnnyCbad

    Re: Add HTML to XML Data

    Very nice simple tutorial, good work!


 

 

Similar Threads

  1. [Tutorial] GTA Online - How to use images as emblems with XML/HTML editing
    By Idlehands88 in forum Xbox 360 Tutorials
    Replies: 13
    Last Post: 10-23-2013, 04:19 AM
  2. XML Introduction - What is XML?
    By JizzaBeez in forum Tutorials and Resources
    Replies: 0
    Last Post: 03-03-2011, 07:00 AM
  3. HTML Basic
    By JizzaBeez in forum Tutorials and Resources
    Replies: 1
    Last Post: 03-03-2011, 06:41 AM
  4. HTML Colors
    By JizzaBeez in forum Tutorials and Resources
    Replies: 0
    Last Post: 03-03-2011, 06:39 AM
  5. HTML Tables
    By JizzaBeez in forum Tutorials and Resources
    Replies: 0
    Last Post: 03-03-2011, 06:18 AM

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
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.
     

About 360haven

    360haven is an Forum Devoted To Game modding Fans from all over the world.

    An Awesome Community of Xbox 360 Gamers, Modders and Developers who Create & Share Tutorials, Applications, Gfx, Trainers and Gamesaves.

    A haven for the l33t.
    A scarce paradise for modders.

Like this page

Google+