Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

XML to HTML

Featured Replies

I want to display some XML Information mid-page and I find that my script isn't working, obviously because it's practically straight in the middle of the body tag..

 

At the moment, I wish to have separate XML for separate pages. So I can have around 120-150 XML Sheets for the website that will also display differential data on each page.

 

I have a live version here: http://universitycom...tan-university/

 

Alternatively, the code I am using is:

 

<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","http://universitycompare.com/wp-content/themes/blue-and-grey/XML/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>

 

I know this isn't right, I know I must have to refer to the XML Script in the header, then display it in the page, but how do I go about doing this? Can't be that hard can it?

 

As The XML information is not displaying...

Edited by OwenONeill

I couldn't really understand what you want ,but can't you just use iframe to load xml file ?!

Edited by Danny87

You mean in the Courses area on that Live site? You have the code within a <textarea> so it's not going to be processed.

  • Author

without textarea it doesn't get processed and breaks the layout of the site, re-check the link...

 

Edit - got it working!

Edited by OwenONeill

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.