Standalone documents as external parsed entities.
James Tauber
jtauber at jtauber.com
Mon Apr 12 18:52:36 BST 1999
> >From my reading of the XML 1.0 spec, it is not possible to have a
> standalone document, with it's own DTD, "included" in another document
> as an external parsed entity.
>
> Am I wrong?
There are ways around it. But for starters, be careful with the term
"standalone" as it means something quite specific in XML (and something
different from what I'm guessing you mean by it).
If you don't care about the DTD, then you can have:
list.xml:
<?xml version="1.0"?>
<!DOCTYPE list [
<!ENTITY doc1 SYSTEM "doc1.xml">
<!ENTITY doc2 SYSTEM "doc2.xml">
]>
<list>
&doc1;
&doc2;
</list>
doc1.xml:
<!-- note null prolog (except for this) -->
<doc>...</doc>
doc2.xml:
<!-- note null prolog (except for this) -->
<doc>...</doc>
In this case doc1.xml and doc2.xml can be treated both as external parsed
entities and as document entities.
If you *do* what the individual external entities to have a DTD, you'll have
to use a wrapper document.
list.xml:
<?xml version="1.0"?>
<!DOCTYPE list SYSTEM "list.dtd" [
<!ENTITY doc1.content SYSTEM "doc1content.xml">
<!ENTITY doc2.content SYSTEM "doc2content.xml">
]>
<list>
<doc>&doc1.content;</doc>
<doc>&doc2.content;</doc>
</list>
doc1.xml:
<?xml version="1.0"?>
<!DOCTYPE doc SYSTEM "doc.dtd" [
<!ENTITY doc.content SYSTEM "doc1content.xml">
]>
<doc>&doc.content;</doc>
doc2.xml:
<?xml version="1.0"?>
<!DOCTYPE doc SYSTEM "doc.dtd" [
<!ENTITY doc.content SYSTEM "doc2content.xml">
]>
<doc>&doc.content;</doc>
doc1content.xml:
<!-- null prolog -->
<!-- content of doc1 -->
doc2content.xml:
<!-- null prolog -->
<!-- content of doc2 -->
Note that because you can't put the document element in an external parsed
entity, it is included in the doc wrappers and in the list.
Hope this helps.
James
--
James Tauber / jtauber at jtauber.com / www.jtauber.com
XML Standards and Product Coordinator
HarvestRoad Communications / www.harvestroad.com.au
Full-day XML Tutorial @ WWW8 : http://www8.org/
Maintainer of : www.xmlinfo.com, www.xmlsoftware.com and www.schema.net
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list