tags:

views:

127

answers:

2
  1. Can an XML file reference two DTDs?
  2. Can a DTD reference elements from another external DTD?
A: 

First question: Yes (see this post for an example and explanation)

Second question: I haven't tried it, but using the technique explained in that post it should be possible...

PhilS
<pre> That helped, PhilS, thank you. And this is what I used. <?xml version="1.0"?><!DOCTYPE Metadata [ <!ENTITY % BIO SYSTEM "../BIO.dtd"> %BIO; <!ENTITY % WEB SYSTEM "../WebContent.dtd"> %WEB; ] ></pre>
ssha
A: 
  1. as far as I know - no, they can't. As a comment to PhilS's post - the example he linked is just an example of an embedded DTD with references to other DTDs. It's an example of question 2.
  2. DTDs can be splitted into independent parts. You can define it via <!ENTITY % name SYSTEM "name.dtd">%name; (roughly translated from XML in a Nutshell). An example DTD for that is the DocBook-DTD. It consits of 28 parts.

(I failed to put the code in a quoted section, so it wasn't shown - sorry).

Tobias Langner
Regarding first comment to my post: technically this is true, but otherwise it wouldn't make sense - as a xml-doc has only one root node, you wouldn't want to attach two dtds to it...
PhilS