- Can an XML file reference two DTDs?
- Can a DTD reference elements from another external DTD?
views:
127answers:
2
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
2009-06-02 14:15:20
<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
2009-06-02 14:25:27
A:
- 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.
- 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
2009-06-02 14:19:32
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
2009-06-02 14:26:53