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: [docbook] Validator trouble


Hi

On Thu 2004-07-08 Ben Branders wrote:
> The whole document is one book, divided into different parts.  The
> parts are seperate files (which are divided into sections).
> 
> I'm using the validator on sf.net (http://validate.sf.net/) to
> validate the sourcefiles.  I thought I was writing good XML, but the
> validator keeps spitting out error messages.

I suggest to use (a) local validator(s), you'll get the results much
faster (no need to transfer the files to the server of the online
validator). In order to also avoid the repeated download of the DTD I
suggest to set up catalogs, check

http://www.sagehill.net/docbookxsl/Catalogs.html
http://www.sagehill.net/docbookxsl/WriteCatalog.html

and

http://www.pinkjuice.com/howto/vimxml/setup.xml#catalogs

> It says that you have to declare the DocType on the first line, but
> there I have my <xml ...?>.

The included files can't have a doctype declaration.

> What do I have to do to make it valid?

Lots of things :)

eg something like

  $ wget -q -nd -A xml -l 1 -r http://bytewarrior.madoka.be/jabber/psi_docbook/
  $ ls
  advanced.xml  basic.xml  introduction.xml  psi.xml
  $ # remove doctype from included files:
  $ for included in introduction.xml basic.xml advanced.xml; do
  > (echo '/<!DOCTYPE/d'; echo wq) | ed -s $included
  > done
  $ ed psi.xml
  817
  g/<!ENTITY/p
  <!ENTITY introduction SYSTEM "introduction.xml">
  <!ENTITY installation SYSTEM "installation.xml">
  <!ENTITY basic SYSTEM "basic.xml">
  <!ENTITY advanced SYSTEM "advanced.xml">
  # installation.xml is not available
  /<!ENTITY.*installation/d
  /&installation;/d
  wq
  746
  $ xmllint --noout --valid psi.xml 2>&1 | head -n 1
  introduction.xml:29: element chapter: validity error : Element chapter content does no
  t follow the DTD, expecting (beginpage? , chapterinfo? , (title , subtitle? , titleabb
  [...]
  $ ed introduction.xml
  1076
  /<chapter>/a
  <title>foo</title>
  .
  wq
  1095
  $ xmllint --noout --valid psi.xml 2>&1 | head -n 1
  introduction.xml:31: element part: validity error : Element part content does not foll
  ow the DTD, expecting (beginpage? , partinfo? , (title , [...]
  $ ed introduction.xml
  1095
  /<part>/a
  <title>foo</title>
  .
  wq
  1114
  $ xmllint --noout --valid psi.xml 2>&1 | head -n 1
  basic.xml:35: element para: validity error : Element para is not declared in para list
  of possible children
  $ # [... todo: fix more validity errors ...]
  $ # validate included files:
  $ xmllint --noout --dtdvalidfpi "-//OASIS//DTD DocBook XML V4.2//EN" \
  > introduction.xml 2>&1 | head -n 1
  $ xmllint --noout --dtdvalidfpi "-//OASIS//DTD DocBook XML V4.2//EN" \
  > basic.xml 2>&1 | head -n 1
  basic.xml:63: parser error : Opening and ending tag mismatch:
  wordasword line 59 and para
  $ xmllint --noout --dtdvalidfpi "-//OASIS//DTD DocBook XML V4.2//EN" \
  > advanced.xml 2>&1 | head -n 1
  advanced.xml:3: element part: validity error : Element part content
  does not follow the DTD, expecting [...]
  $

> As I already said, I'm using multiple sources.  Do I have to declare the
> DocType in every XML or just in the main XML file?

The latter.

Tobi

-- 
to
  bi
    as
  re
if

Attachment: pgp00000.pgp
Description: PGP signature


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