W3C home > Mailing lists > Public > www-validator@w3.org > February 2002

RE: Problem with ATTLIST

From: Patterson, Elizabeth <elizabeth.patterson@sap.com>
Date: Fri, 22 Feb 2002 04:27:21 +0100
Message-ID: <FBF77CAA2771D31188580008C79182F2052B2B40@usphlx16>
To: "'Nick Kew'" <nick@webthing.com>
Cc: "'www-validator@w3.org'" <www-validator@w3.org>
Thanks for your response. I pull the code into the html file with the
following statements:

	 var xmlDoc1=new ActiveXObject("microsoft.xmldom");
	  
	 xmlDoc1.load("Listing6-1.xml");

The xml file Listing6-1.xml is in the same directory as the html file. This
works fine if I remove the ATTLIST statements and the attributes from the
<E-MAIL> statement.

I should have pasted in the code in question. I am pasting the full code for
the xml and html files below. 

The code for the xml file is as follows:

	Listing6-1.xml

	<?xml version="1.0"?>
	<!-- This file demonstrates the use of an attribute list to qualify
data. -->
	<!DOCTYPE E-MAIL[
		<!ELEMENT E-MAIL (TO+,FROM,CC*,BCC*,SUBJECT?,BODY?)>
		<!ATTLIST E-MAIL LANGUAGE (Western|Extended) "Western">
		<!ATTLIST E-MAIL ENCRYPTION (64|128|256) "128">
		<!ATTLIST E-MAIL PRIORITY (low|normal|high) "normal">
		<!ELEMENT TO (#PCDATA)>
		<!ELEMENT FROM (#PCDATA)>
		<!ELEMENT CC (#PCDATA)>
		<!ELEMENT BCC (#PCDATA)>
		<!ELEMENT SUBJECT (#PCDATA)>
		<!ELEMENT BODY (#PCDATA)>
	]>
	<E-MAIL LANGUAGE="Western" ENCRYPTION="512" PRIORITY="normal">
	<TO>READER</TO>
	<FROM>AUTHOR</FROM>
	<CC></CC>
	<BCC>BCC 1</BCC>
	<BCC>BCC 2</BCC>
	<BCC>BCC 3</BCC>
	<BCC>BCC 4</BCC>
	<SUBJECT>New book</SUBJECT>
	<BODY>Announcing a new book being developed!</BODY>
	</E-MAIL>

	

I tried to load this file with the following html file:

	<HTML>
	<HEAD>
	<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
	<TITLE>Using the array properties of the nodeList to read an xml
file</TITLE>
	<SCRIPT LANGUAGE="JavaScript">
	<!-- 
	 var RootElement1;
	// nodecount will store the number of nodes containing data in the
xml file.
	 var nodecount;
	 var xmlDoc1=new ActiveXObject("microsoft.xmldom");
	 
	 xmlDoc1.load("Listing6-1.xml");
	// xmlDoc1.load("Listing5-9.xml");
	 function StartUp()
	{
	 
	// Stores the url of the last loaded file.
	 var lastURL;
	// Stores the Boolean as to whether the xml is validated.
	 var isValidate;
	// Stores the xml code of the node
	 var xmlType;
	// Stores the numeric code for the node type.
	 var numNodeType;
	 if(xmlDoc1.readyState=="4")
	 {
	 
	  lastURL=xmlDoc1.url;
	  alert(lastURL);
	  isValidate=xmlDoc1.validateOnParse;
	  alert(isValidate);
	  xmlType=xmlDoc1.xml;
	  alert(xmlType);
	  numNodeType=xmlDoc1.nodeType;
	  alert(numNodeType);
	  StartLoading();
	 }
	 else
	 {
	  alert("Process could not start");
	 }
	 }
	 function StartLoading()
	 {
	   // loopindex is the counter used to control the loop that
traverses through the nodes
	   var loopindex;
	   RootElement1=xmlDoc1.documentElement;
	   if(RootElement1==null)
	   {
	    alert("The root node is null");
	    document.write("<B><BIG>The data of the xml file cannot be
accessed</BIG></B><BR>");
	   }
	   else
	   {
	    // We now extract the number of nodes in the list 
	    nodecount=RootElement1.childNodes.length;
	    for(loopindex=0;loopindex<nodecount;loopindex++)
	    {
	     // This line will write out the name of the node to the body
section of the html file
	
document.write(RootElement1.childNodes.item(loopindex).nodeName+": ");
	     // This line will write out the contents of the node to the
body section of the html file
	
document.write(RootElement1.childNodes.item(loopindex).text+"<BR>");
	    }
	   }
	  }
	 //-->
	 </script>
	</HEAD>
	<BODY onLoad="StartUp()">
	<!-- Since all fo the content is now being written from the
JavaScript section, it is no longer
			necessary to put anything here. -->
	</BODY>
	</HTML>

Thanks,

Elizabeth

-----Original Message-----
From: Nick Kew [mailto:nick@webthing.com]
Sent: Thursday, February 21, 2002 1:54 PM
To: Patterson, Elizabeth
Cc: 'www-validator@w3.org'
Subject: Re: Problem with ATTLIST 


On Fri, 15 Feb 2002, Patterson, Elizabeth wrote:

> Hello,
>
> I am hoping you can help me. I am just learning xml and have an xml file
> with a DTD containing the attribute lists. When I view this file in the
> browser, it is fine, but when I try to pull it into an html file it is
> unable to load the file. If I remove the ATTLIST statements from the xml
> file, it works fine. I have attached both the xml file and the html file.

What do you mean by "pull it into an html file"?  A URL would help.

(your email client has incorrectly labelled your attachments as
application/octet-stream, so it's too much trouble for me to
want to look at them).

-- 
Nick Kew

Site Valet - the mark of Quality on the Web.
<URL:http://valet.webthing.com/>
Received on Thursday, 21 February 2002 22:27:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:00 GMT