Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Adding the DTD to Our ML

April 12, 1999

Now that we have at least an initial DTD, we can associate it with our XML document. When any validating XML parser, including the one in IE5, reads the document, it will first parse the DTD and then, if the DTD is syntactically correct, will continue parsing the XML document.

Let's change collection1.xml so that it references the local DTD that we generated in the previous section. Change the opening processing instruction, remembering that XML is case sensitive, so be sure to use exactly the uppercase and lowercase characters shown below. Change:

<?xml version="1.0" standalone="yes" ?>

to

<?xml version="1.0" standalone="no" ?>
<!DOCTYPE Collection SYSTEM "collection1.dtd">

The above document prolog (as it is called) indicates that this XML document requires another document (the DTD) to define it. The DOCTYPE "Collection" by convention matches the root level element of our document viewed as a tree. The word "SYSTEM" implies that the DTD which follows is a local file. Finally, the path to the DTD relative to the XML document is given. If you did not save the generated DTD in the same directory as the XML document, you will need to adjust this path, or simply co-locate the DTD and XML files.

If, however, we wanted to reference a public DTD located on a web server, we would need to use a different DOCTYPE declaration with a PUBLIC qualifier, the name of the language, and the URL of the DTD, along with the same processing instruction:

<?xml version="1.0" standalone="no" ?>
<!DOCTYPE Collection PUBLIC    
"-//WDVL//Collection Markup Language//EN"
"http://wdvl.Internet.com/Authoring/Languages/
  XML/Tutorials/DoingIt/Examples/collection1.dtd">
The above URL has been wrapped simply to make this page more readable. In practise, you should not split this URL or any string in XML.

You have already downloaded an example of each case:

Generating a DTD the Easy Way
Doing It With XML, Part 1
Viewing It With IE5, Take 2


Up to => Home / Authoring / Languages / XML / Tutorials / DoingIt




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers