HTML5

xml inserted

Joost v@n Meeteren


Links

W3C - XML Tutorial.


Example

XML 1.0 | Insertion by JavaScript


Source code

XML 1.0 ( | Insertion by JavaScript )


<xml> example in HTML5:

<script>
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","../html5/xml_and_css.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML; 

document.write("<section class=\"webdevelopment\">");
var x=xmlDoc.getElementsByTagName("webdevelopment");
for (i=0;i<x.length;i++)
  { 
  document.write("<p class=\"header_one\">");
  document.write(x[i].getElementsByTagName("header_one")[0].childNodes[0].nodeValue);
  document.write("</p>");
  document.write("<p class=\"header_two\">");
  document.write(x[i].getElementsByTagName("header_two")[0].childNodes[0].nodeValue);
  document.write("</p>");
  document.write("<p class=\"header_three\">");
  document.write(x[i].getElementsByTagName("header_three")[0].childNodes[0].nodeValue);
  document.write("</p>");
  document.write("<p class=\"xml\">");
  document.write(x[i].getElementsByTagName("xml")[0].childNodes[0].nodeValue);
  document.write("</p>");
  }
document.write("</section>");
</script>


XML 1.0 document:

<?xml version="1.0" encoding="utf-8"?>

<?xml-stylesheet type="text/css" href="../sgml/xml_and_css.css"?>

<webdevelopment>
<header_one>WebDevelopment and WebDesign</header_one>
<header_two>Joost v@n Meeteren</header_two>
<header_three>Design, maintenance, advice / support, editing, training, BS, RWD, SEO, VAL | PHOTOGRAPHY | 2015</header_three>
<xml>This page is developed in XML 1.0, using a CSS stylesheet.</xml>
</webdevelopment>


Document

XML 1.0

See original XML with CSS example.


WebDevelopment and WebDesign 2002-2019 © Joost van Meeteren
Web Developer/Designer/Photographer
Last update Thursday, September 19, 2019 at 09:19

Back

Back to HTML5 insert elements.