This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: where to store entity references


/ Erik Price <pricee@hhbrown.com> was heard to say:
| Instead of putting all of the entities directly at this point, can I
| just keep them in their separate file and declare an entity reference
| to the file full of entity declarations?  Like this:
|
| <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
| "system.identifier"
| [
| 	<!ENTITY entityfile SYSTEM "path/to/file">
| 	&entityfile;
| ]
|  >
|
| Now will all of my entities (in that file) be "included" into the
| document?

Yes. But note that you have to use a parameter entity in the internal subset
in order to make this work:

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"system.identifier"
[
	<!ENTITY % entityfile SYSTEM "path/to/file">
	%entityfile;
]>

The entities declared in "/path/to/file" should still be external
general entities, it's only the one that you want to have expanded
"before parsing" that needs to be a parameter entity.

| The other question I have is, can I specify a relative path to a file
| in an external general entity reference?  Like above?  Or should it
| start with "./path/to/file" to indicate "current working directory"?
|
| Or must those paths be absolute?

There's no difference between "path/to/file" and "./path/to/file"
(those are both relative paths). And both do what you expect, they're
perfectly legitimate. The trick is that they should be relative to the
entity in which they are declared. Some parsers get this wrong
(notably some older versions of AElfred, Saxon's default parser).

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com>      | Words--so innocent and powerless
http://www.oasis-open.org/docbook/ | they are, as standing in a
Chair, DocBook Technical Committee | dictionary, how potent for good
                                   | and evil they become, in the hands
                                   | of one who knows how to use
                                   | them!--Nathaniel Hawthorne


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]