LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives


XML-L Archives

XML-L Archives


View:

Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font

Options:

Join or Leave XML-L
Reply | Post New Message
Search Archives


Subject: Re: Referencing Multiple DTDs in a single XML file
From: Peter Flynn <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Tue, 9 Mar 1999 13:04:33 +0000
Content-Type:text/plain
Parts/Attachments:
Parts/Attachments

text/plain (52 lines)


> Now to specify both DTDs in an XML file ('Transaction.XML'), I would do
> something like this
>
>                 <?xml version=3D"1.0"?>
>                 <!DOCTYPE enterpriseDataFormat SYSTEM
> "enterpriseDataFormat.DTD">
>                 <!DOCTYPE datasourceTransaction SYSTEM "Transaction.DTD">

No, you can't have two DocType Declarations. A document must belong
to one or the other: it cannot serve two masters...

If the root element type is declared in a DTD, then just change the
DocType Declaration so it refers to the root element type, but give the
name of the DTD where that is to be found, eg

   <!DOCTYPE enterpriseDataFormat SYSTEM "Transaction.DTD">

A document that refers to a DTD does not have to start at the root
element implied by the DTD as a whole. This is the normal way to refer
to a fragment, eg this is a perfectly valid instance:

   <?xml version="1.0"?>
   <!DOCTYPE P SYSTEM "html4.0.dtd">
   <P>Here's a <em>real</em> fragment</P>

> Now in "XML: A Primer" there's no indication for the syntax to =
> reference one
> DTD from another so I assumed that the XML document type declaration =
> syntax
> could be used in a DTD (fool that I am:-)). If I move the
> 'enterpriseDataFormat' document type declaration line from =
> 'Transaction.XML'
> to 'Transaction.DTD' then both XML4J and MSXML complain that DOCTYPE is =
> not
> a valid DTD keyword. Simon?

XML uses SGML. All the basic rules of SGML apply, including entity
references. If you want to build and manage DTDs it might be worth
getting a good book about DTDs like Eve Maler and Jeanne el
Andaloussi's "SGML DTDs: from text to model to markup" (details in the
SGML bibliography).

> Is there a way of working this without having to merge the DTD files?

Yes, you can write a DTD in modular fashion, so it includes code
from other files, using entity references.

> Should a parser accept more than one document type declaration?

Nope.

///Peter

Back to: Top of Message | Previous Page | Main XML-L Page

Permalink



LISTSERV.HEANET.IE

CataList Email List Search Powered by the LISTSERV Email List Manager