eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak


Introduction to XML For Web Developers
Internal Versus External DTDs  

As we have already alluded to several times throughout this tutorial, a DTD can either be included as part of a well-formed XML document (standalone=yes) or it can be referenced from an external source (standalone=no).

The benefits of using external DTDs is that they can more easily and efficiently be shared by more than one XML document, or in fact, many organizations with the need to standardize communications and data. You can write a DTD once and have multiple documents reference it. Not only does this save typing time, but it assures that as the DTD manager makes changes to the central DTD, all documents that rely on the DTD are updated in one fell swoop (Of course, DTD changes will not necessarily be backwards compatible, so watch out!).

In order to reference an external DTD, you must change both the XML declaration and the DOCTYPE declaration.

The XML Declaration must be changed to reflect the fact that the XML document will not work on its own. That is, it will not be standalone.

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

You will also need to change the DOCTYPE declaration to add the SYSTEM attribute.


such as....

	             SYSTEM "http://www.mydomain.com/dtds/contacts.dtd">

Note also, that the URL may be a relative or absolute file location such as....

	             SYSTEM "contacts.dtd">

which specifies a dtd file in the same directory as the XML document that references it. Or, similarly, you can reference the same document up one directory and down one into the "dtds" directory.

	             SYSTEM "../dtds/contacts.dtd">

Using this method, you can simply cut out the DTD from your XML document and paste it into the separate document called contacts.dtd. Thus, you have one file with the DTD and one file with the well-formed XML document.

Previous Page | Next Page | Table of Contents