Peter at ursus.demon.co.uk
Sat May 10 00:32:37 BST 1997
In message <s37306c4.045 at rnib.org.uk> David Pawson writes:
> Will the same mechanism work for XML,
> <?XML version ....
> <DOCTYPE empty ... dtd >
> #include sub-file <!-- you choose the words -->
This was about the first question I asked on comp.text.sgml
2-3 years ago, so it's nice to be in a position to answer it.
It's not intuitive to someone brought up on C - you keep looking for the
#include in SGML (XML) and it isn't there. Instead there is a mechanism
involving *entities*. In simple terms, parameter entities (which use
the %foo; notation) are mainly involved in DTDs, and general entities
(like &bar;) are used to include chunks of data.
You will find them in the draft in 4.2 , 4.3 (and their treatment in 4.4).
In your example you might have something like:
<!DOCTYPE empty [
<!ENTITY chunk1 SYSTEM "chunk1.txt">
<!ENTITY chunk2 SYSTEM "chunk2.txt">
<!-- note how the [...] is included in the DOCTYPE -->
<!-- include chunk1 -->
<!-- include chunk2 -->
This is OK so long as the contents of the files are well formed. If
the document is to be valid, then the complete document after inclusion
of the chunks has to be valid. If the chunks contain entities, then
those have to be (recursively) expanded.
Make sure the entities have been declared. However, XML says that
for WF documents, the processor need not expand entities. (4.4; 8).
I'm not sure whether the entity still has to be declared in this case.
General point: Example files of this sort of thing would be very valuable.
> Sounds simple enough to do what I might want to do.
> Come on gurus, what was it all about in the first place?
> It wasn't that long ago that you have forgotten ... was it!
> Regards, DaveP
> xml-dev: A list for W3C XML Developers
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
> To unsubscribe, send to majordomo at ic.ac.uk the following message;
> unsubscribe xml-dev
> List coordinator, Henry Rzepa (rzepa at ic.ac.uk)
Peter Murray-Rust, domestic net connection
Virtual School of Molecular Sciences
xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (rzepa at ic.ac.uk)
More information about the Xml-dev