Slide 3.3: How can XML be used?
Slide 3.5: XHTML (eXtensible HyperText Markup Language)
Home

How Can XML Be Used? (Cont.)


XML Makes Your Data More Available.
Since XML is independent of hardware, software and application, XML can make your data more available and useful. Different applications can access your data, not only in HTML pages, but also from XML data sources. With XML, your data can be available to all kinds of “reading machines” (handheld computers, voice machines, news feeds, etc), and make it more available for blind people, or people with other disabilities.

XML and B2B
With XML, financial information can be exchanged over the Internet. XML is the main language for exchanging financial information between businesses over the Internet.

XML Is Used to Create New Internet Languages.
A lot of new Internet languages are created with XML. For example, If Developers Have Sense
If they do have sense, future applications will exchange their data in XML. The future might give us word processors, spreadsheet applications and databases that can read each other’s data in a pure text format, without any conversion utilities in between. We can only pray that all the software vendors will agree.


Demonstration
The following demonstration shows how to navigate through the XML records with JavaScript. JavaScript will not be covered in this course.

           

 
<html>
 <head>
  <script type="text/javascript">
   var xmlDoc;
   if ( window.XMLHttpRequest ) {
    xhttp = new XMLHttpRequest( );
   }
   else { // Internet Explorer 5/6
    xhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
   xhttp.open( "GET", "http://undcemcs01.und.edu/~wen.chen.hu/course/260/3/cd_catalog.xml", false );
   xhttp.send( "" );
   xmlDoc = xhttp.responseXML;

   var x = xmlDoc.getElementsByTagName("CD"); 
   i = 0;

   function next( ) {
    if ( i < x.length-1 ) {
     i++;
     display( );
    }
   }
   function previous( ) {
    if ( i > 0 ) {
     i--;
     display( );
    }
   }
   function display( ) {
    artist = (x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue);
    title  = (x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
    year   = (x[i].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue);
    document.getElementById("show").innerHTML =
      "Artist: " + artist + "Title: " + title + "Year: "+ year;
   }
  </script>
 </head>
 <body onload="display( )">
  <div id='show'></div><br />
  <input type="button" onclick="previous()" value="previous" />
  <input type="button" onclick="next()" value="next" />
 </body>
</html>