[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: DTD - Is it the right way?
At 01:28 PM 05/13/1999 +0000, suresh@n... 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@p... | is arrested development. http://www.flixml.org | -- Alice Roosevelt Longworth xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... 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@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|