Discussion:
Help required with Docbook XML DTD - generates errors
(too old to reply)
Henry Law
2006-12-12 10:04:49 UTC
Permalink
I'm trying to get myself set up to do Docbook documentation (I was an
IBM Bookmaster man in a previous century so I'm expecting to feel right
at home ...). I've got PSGML installed and I can use xsltproc to
convert sample Docbook documents into HTML and PDF, but I'm stuck on
using emacs (XEmacs, actually) with the Docbook DTD: the latter seems to
have errors in it, which I can't believe. Can someone help, or point me
to some source of assistance? I've googled my error messages and a
number of other relevant topics and just made myself more confused.

Running under Windows XP I'm using the docbookx.dtd at version 4.5
downloaded direct from docbook.org. I've created a one-line SGML file
containing

<!DOCTYPE book system "file:///C:/SGML/DTD/Docbook-XML-4.5/docbookx.dtd">

When I use the "parse DTD" feature of PSGML within XEMacs it complains
as follows:

c:\SGML\DTD\Docbook-XML-4.5\ent\isotech.ent line 23 col 11 entity
common.attrib
c:\SGML\DTD\Docbook-XML-4.5\dbpoolx.mod line 847 col 31 entity dbpool
c:\SGML\DTD\Docbook-XML-4.5\docbookx.dtd line 136 col 8 entity BOOK
F:\WIP\test.sgml line 1 col 72
Name expected; at: :base CDATA

... and gives up. I downloaded a DTD parser called Matra from
SourceForge and used one of its features - production of a DTD tree - to
check the same DTD and confusingly got a different message: "Got null
entity for - 'sgml.features'." - I had a look at the DTD code but at my
current level of knowledge couldn't see anything wrong; and in any case
it's freshly downloaded and presumably doesn't contain obvious errors.

Can someone help me out of this fog?
--
Henry Law <>< Manchester, England
Henry Law
2006-12-12 10:34:36 UTC
Permalink
Post by Henry Law
c:\SGML\DTD\Docbook-XML-4.5\ent\isotech.ent line 23 col 11 entity
common.attrib
c:\SGML\DTD\Docbook-XML-4.5\dbpoolx.mod line 847 col 31 entity dbpool
c:\SGML\DTD\Docbook-XML-4.5\docbookx.dtd line 136 col 8 entity BOOK
F:\WIP\test.sgml line 1 col 72
Name expected; at: :base CDATA
Further info: I downloaded a trial copy of XMLSpy and used it to produce
a valid XML document with that DTD; it still fails in PSGML.
--
Henry Law <>< Manchester, England
Peter Flynn
2006-12-13 00:17:37 UTC
Permalink
Post by Henry Law
I'm trying to get myself set up to do Docbook documentation (I was an
IBM Bookmaster man in a previous century so I'm expecting to feel right
at home ...). I've got PSGML installed and I can use xsltproc to
convert sample Docbook documents into HTML and PDF, but I'm stuck on
using emacs (XEmacs, actually) with the Docbook DTD: the latter seems to
have errors in it, which I can't believe. Can someone help, or point me
to some source of assistance? I've googled my error messages and a
number of other relevant topics and just made myself more confused.
I'm using DB 4.5 with GNU Emacs and psgml (in Linux) and there don't
appear to be any errors in that version of DocBook.

When you say you're using XEmacs (under Windows) do you mean NTemacs?
Post by Henry Law
Running under Windows XP I'm using the docbookx.dtd at version 4.5
downloaded direct from docbook.org. I've created a one-line SGML file
containing
<!DOCTYPE book system "file:///C:/SGML/DTD/Docbook-XML-4.5/docbookx.dtd">
You need to be in XML mode to use an XML DTD. Are you in SGML mode?
Post by Henry Law
When I use the "parse DTD" feature of PSGML within XEMacs it complains
c:\SGML\DTD\Docbook-XML-4.5\ent\isotech.ent line 23 col 11 entity
common.attrib
c:\SGML\DTD\Docbook-XML-4.5\dbpoolx.mod line 847 col 31 entity dbpool
c:\SGML\DTD\Docbook-XML-4.5\docbookx.dtd line 136 col 8 entity BOOK
F:\WIP\test.sgml line 1 col 72
Name expected; at: :base CDATA
Yep. Looks like you're in SGML mode, so it's expecting the syntax of the
ENTITY declaration to include a data text literal (eg CDATA, SDATA, or
PI), which XML doesn't use.

a) Don't use .sgml for XML files. Use .xml instead
b) Add these two line to your c:\.emacs:

(setq auto-mode-alist (cons
'("\\.[xXoOmMdD][HhnNmMeESs][TtmMlLaAbBDd]?[pP]?$" . xml-mode)
auto-mode-alist))
(autoload 'xml-mode "psgml" nil t)
Post by Henry Law
... and gives up. I downloaded a DTD parser called Matra from
SourceForge and used one of its features - production of a DTD tree - to
check the same DTD and confusingly got a different message: "Got null
entity for - 'sgml.features'." - I had a look at the DTD code but at my
current level of knowledge couldn't see anything wrong; and in any case
it's freshly downloaded and presumably doesn't contain obvious errors.
Can someone help me out of this fog?
c) Install OpenSP for Windows from
http://bjoern.hoehrmann.de/ports/OpenSP-1.5.1-win32-bin.zip
d) Add these lines to your c:\.emacs:

(setq sgml-xml-declaration "/path/to/your/copy/of/xml.dcl")
(setq sgml-validate-command "onsgmls -s -c/path/to/your/catalog %s %s")
(setq sgml-xml-validate-command "onsgmls -wxml -s -E 5000 %s %s")
(setq sgml-catalog-files '("/path/to/your/catalog" "catalog"))

Now you should be able to conduct a validation with C-c C-v

e) Consider adding François Pinard's xxml-mode which adds some useful
XML bells and whistles.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Henry Law
2006-12-14 23:07:18 UTC
Permalink
Peter, thank you for the informative reply.
Post by Peter Flynn
When you say you're using XEmacs (under Windows) do you mean NTemacs?
Maybe; but its executable is called xemacs.exe and it comes up saying
XEmacs 21.4 patch 19 ...
Post by Peter Flynn
Yep. Looks like you're in SGML mode, so it's expecting the syntax of the
ENTITY declaration to include a data text literal (eg CDATA, SDATA, or
PI), which XML doesn't use.
a) Don't use .sgml for XML files. Use .xml instead
Aha; some measure of dawn is beginning to break.
Post by Peter Flynn
(setq auto-mode-alist (cons
'("\\.[xXoOmMdD][HhnNmMeESs][TtmMlLaAbBDd]?[pP]?$" . xml-mode)
auto-mode-alist))
(autoload 'xml-mode "psgml" nil t)
c) Install OpenSP for Windows from
http://bjoern.hoehrmann.de/ports/OpenSP-1.5.1-win32-bin.zip
(setq sgml-xml-declaration "/path/to/your/copy/of/xml.dcl")
(setq sgml-validate-command "onsgmls -s -c/path/to/your/catalog %s %s")
(setq sgml-xml-validate-command "onsgmls -wxml -s -E 5000 %s %s")
(setq sgml-catalog-files '("/path/to/your/catalog" "catalog"))
Now you should be able to conduct a validation with C-c C-v
e) Consider adding François Pinard's xxml-mode which adds some useful
XML bells and whistles.
I'll have a go at those. But in the mean time I switched from 4.5 of
the Docbook DTD to 4.2 (can't remember why; something I googled
suggested it) and everything works as I want it to. Weird; and plainly
not a long-term solution. But at least I can write Docbook while I'm
fiddling with the technology. Thanks again.
--
Henry Law <>< Manchester, England
William F Hammond
2006-12-16 16:09:02 UTC
Permalink
Post by Henry Law
Post by Peter Flynn
When you say you're using XEmacs (under Windows) do you mean NTemacs?
Maybe; but its executable is called xemacs.exe and it comes up saying
XEmacs 21.4 patch 19 ...
Is this "XEmacs" installed under cygwin/X11? If so, maybe you want to
pick up OpenSP as a cygwin package. (But I've never looked at psgml
under cygwin, nor do I use the non-GNU version of Emacs. I do know
that OpenSP under cygwin works well.)

-- Bill

Loading...