All pastes #410399 Raw Edit

Unnamed

public text v1 · immutable
#410399 ·published 2007-03-26 11:00 UTC
rendered paste body

<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>792733</title>
		<style type="text/css">
    		</style>
		<script type="text/javascript" src="http://www.cs.bham.ac.uk/~pxc/langinf/xhrlib.js"></script>
		<script type="text/javascript">
		<!--
		var displyDiv = null;

		function init(displayDivID){
			displayDiv = document.getElementById(displayDivID);
			requestXML('Ex9.xml', doDisplay);
		}		

		function doDisplay(xmlDoc){
			var books = xmlDoc.getElementsByTagName('book');
			var data = new Array();
			for(var iBook = 0; iBook < books.length; iBook++){
				var book = books[iBook];
				data[iBook] = new Array();
				data[iBook][0] = book.getElementsByTagName('author')[0].firstChild.data;
				data[iBook][1] = book.getElementsByTagName('title')[0].firstChild.data;
				data[iBook][2] = book.getElementsByTagName('publisher')[0].firstChild.data;
				}

				addTable(displayDiv, ['Author','title','publisher'], data);
			}




// XML STARTS HERE
<?xml version="1.0"?>
<!DOCTYPE results [
  <!ELEMENT list (book?,cd?)*>

  <!ELEMENT book (title,author?,publisher,year?,condition?,price)>
  <!ATTLIST book id ID #REQUIRED>
  <!ELEMENT title (#PCDATA)>
  <!ELEMENT author (#PCDATA)>
  <!ELEMENT publisher (#PCDATA)>
  <!ELEMENT year (#PCDATA)>
  <!ELEMENT condition (#PCDATA)>
  <!ELEMENT price (#PCDATA)>
  <!ATTLIST price unit (GBP|EUR) #REQUIRED>

  <!ELEMENT cd (title,artist,year?,condition?,price)>
  <!ATTLIST cd id ID #REQUIRED>
  <!ELEMENT artist (#PCDATA)>
]>
<list>
  <book id="I1341">
    <title>Understanding JavaScript</title>
    <author>Authotest</author>
    <publisher>Mott &amp; Sons</publisher>
    <year>2004</year>
    <condition>Good</condition>
    <price unit="GBP">4.95</price>
  </book>