OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: DTD - Is it the right way?

[ Lists Home | Date Index | Thread Index ]
  • From: "John E. Simpson" <simpson@polaris.net>
  • To: suresh@niitblvl.niit.co.in, xml-dev@ic.ac.uk
  • Date: Mon, 05 Jul 1999 09:55:09 -0400

At 01:28 PM 05/13/1999 +0000, suresh@niitblvl.niit.co.in wrote:
>...Below is a DTD I have written for Contacts. I have   
>used a tool called as XML Spy. I have a few questions
>1. Is this is the right way of writing a DTD?

Sure -- although "a" right way might be a better way of putting it. As long
as the DTD is syntactically correct and leads to structurally sound
documents, any way of writing a DTD is as good as any other. 

>2. The tool said that the DTD was valid, but I cant open it in IE5.

The best you'd be able to do in IE5 would be to open the DTD as a text
file. You may have misunderstood something important: that IE5 (and other
"XML browser/viewer"-type products) is meant not for viewing DTDs, but for
viewing *XML documents*. These may or may not be documents conforming to a
DTD (called valid and well-formed documents, respectively); but the DTD
itself isn't something a browser would need to display.

(Although it's correct, your DTD does have one odd feature -- which may not
be odd at all, of course, if your application demands it. The question I
have about it is whether you really need to specify multiple content models
(="formats") for a Person's FullName -- FirstName+MiddleInitials+LastName,
LastName+FirstName+MiddleInitials, and so on. Typically you'd just need to
pick one content model. If your application needs to read various formats,
it would be up to the app to modify the document structure to conform to
the DTD's single acceptable one; if it needs to "display" various formats,
this can be accomplished with a style sheet or a downstream application.)

So, given your DTD, the next step is to create a document based on it. This
might look something like the following:

	<xml version="1.0" encoding="UTF-8">
	<!DOCTYPE Contacts SYSTEM "Contacts.dtd">
	<Contacts>
	   <Contact>
	      <Person>
	         <FullName>
	            ... etc. ...
	         </FullName>
	      </Person>
	   </Contact>
	   <Contact>
	      <Person>
	         <FullName>
	            ... etc. ...
	         </FullName>
	      </Person>
	   </Contact>
	</Contacts>

(Replace "Contacts.dtd" in the above with the path to your DTD, whatever
it's called.)

Save the file, then view it (again, *not* the DTD) in IE5.

BTW, a better place for general XML questions might be the XML-L mailing
list. You can access XML-L and its archives, and/or subscribe and
unsubscribe to the list, at:
	http://listserv.heanet.ie/xml-l.html
In theory, XML-DEV is for discussion about issues relating to the
development of XML software... although list members will tackle
practically any reasonable question. :)

==========================================================
John E. Simpson            | The secret of eternal youth
simpson@polaris.net        | is arrested development.
http://www.flixml.org      |  -- Alice Roosevelt Longworth

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS