DTD entity reference resolve

P

Per

Hi,

I'm struggling with the DocBook XML DTD, which can be found at
http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd.

But this DTD seems to somehow include some other documents. E.g.:

<!ENTITY % dbhier.module "INCLUDE">
<![ %dbhier.module; [
<!ENTITY % dbhier PUBLIC
"-//OASIS//ELEMENTS DocBook Document Hierarchy V4.2//EN"
"dbhierx.mod">
%dbhier;
]]>

But my editor seems to not support this. So, it (the editor) is not
able to show me popup/editing help, as it does not know the entities
of the DTD (as they are included).

Is this correct?

Is there a way to easily produce one big DTD, with all the included
DTD files inside?

Or is there a good editor, which supports this format of DTDs?
 
P

Paul A. Hoadley

But my editor seems to not support this. So, it (the editor) is not
able to show me popup/editing help, as it does not know the entities
of the DTD (as they are included).

What editor are you using? It really should be able to handle this.
Is there a way to easily produce one big DTD, with all the included
DTD files inside?

Simplified DocBook is distributed with a flattened DTD, but if you
need the full DocBook DTD, you could try Norm Walsh's 'flatten' perl
script:

http://nwalsh.com/perl/flatten/index.html
Or is there a good editor, which supports this format of DTDs?

There sure is: emacs with either PSGML or nxml-mode.

(As always, faster and better DocBook answers are available from the
mailing lists:)

http://docbook.org/mailinglist/index.html
 
P

Per

Hi Paul,

Thank you very much for your helpfull response.
What editor are you using? It really should be able to handle this.

I'm using IntelliJ IDEA development environment. Its primary focus is
Java development but it has an XML mode too.

Uhm, but maybe I'm using the DTD incorrectly? Inside one of the
included DTD modules, it says this:

In DTD driver files referring to this module, please use an
entity
declaration that uses the public identifier shown below:

<!ENTITY % dbnotn PUBLIC
"-//OASIS//ENTITIES DocBook XML Notations V4.1.2//EN"
"dbnotnx.mod">
%dbnotn;

Seems like the docbook DTDs are made such that I can customize the use
of docbook. This I get from this text in the main DTD:

For example, if your document's top-level element is Book, and
you are using DocBook directly, use the FPI in the DOCTYPE
declaration:

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd"
[...]>

Or, if you have a higher-level driver file that customizes
DocBook,
use the FPI in the parameter entity declaration:

<!ENTITY % DocBookDTD PUBLIC "-//OASIS//DTD DocBook XML
V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
%DocBookDTD;

But in my docbook source, I simply have this simple DOCTYPE in the
top:

<?xml version='1.0'?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

Can (or should) I specificly import the DTD modules, maybe by chosing
between only some, if I only need some!?
Simplified DocBook is distributed with a flattened DTD, but if you
need the full DocBook DTD, you could try Norm Walsh's 'flatten' perl
script:

http://nwalsh.com/perl/flatten/index.html

Thanks. Had a go on it, and after hacking a bit, I got it to eat the
4.1.2 docbook dtds. So now I have a flattened version. And it works in
my editor.
Great!
There sure is: emacs with either PSGML or nxml-mode.

Oh yeah emacs. Maybe I will go back to using emacs for docbook edit.
Seems like I always come back to that great editor :)

Regards, Per
 
P

Paul A. Hoadley

Hi Per,

Uhm, but maybe I'm using the DTD incorrectly?

I don't know anything about your editor, but you want to direct it at
'docbookx.dtd' by whatever mechanism it supports. This is most likely
a SYSTEM entry in the DOCTYPE. You've used a URL here:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd"
[...]>

which is fine, but your editor may not be able to retrieve that. You
may want to just point it to where 'docbookx.dtd' is on your local
filesystem.
Can (or should) I specificly import the DTD modules, maybe by
chosing between only some, if I only need some!?

You're absolutely right in that DocBook's DTD is organised in a
modular fashion to allow for customising, but to just edit with the
standard DTD, you shouldn't need to do anything more than point your
editor at the top-level file, 'docbookx.dtd'.
Thanks. Had a go on it, and after hacking a bit, I got it to eat the
4.1.2 docbook dtds. So now I have a flattened version. And it works
in my editor. Great!

Well done. Can you put the flattened version on the web somewhere?
Oh yeah emacs. Maybe I will go back to using emacs for docbook edit.
Seems like I always come back to that great editor :)

:)
 
P

Per

I don't know anything about your editor, but you want to direct it at
'docbookx.dtd' by whatever mechanism it supports. This is most likely
a SYSTEM entry in the DOCTYPE. You've used a URL here:

[SNIP]
which is fine, but your editor may not be able to retrieve that. You
may want to just point it to where 'docbookx.dtd' is on your local
filesystem.

It can get them from URLs. Have worked fine with other DTDs. Think I
will give them a bugreport at JetBrains (the makers of IDEA). They
tend to listen :)

And then I will go right at getting it to work with Emacs. I guess it
can do it without a flattened version?
Well done. Can you put the flattened version on the web somewhere?

I do not have somewhere I can put it myself. But I will give it away
to someone who has. But will it be "legal" to publish it outside the
OASIS? Haven't had a look at the license.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top