validate entities within a subdocument

Having trouble installing Oxygen? Got a bug to report? Post it all here.
J.Raab
Posts: 2
Joined: Wed Feb 01, 2006 2:21 pm

validate entities within a subdocument

Post by J.Raab »

Hi!

I'm working on a docbook project, which splits up a book into separate files for each chapter. We would like to use entities for several centralized parameters. However, Oxygen does not validate the subdocuments, since all entities are loaded in the "main"-file. It is unable to find the declaration of the entities (but I can render it without any problem).

entities.ent:

Code: Select all


<!ENTITY javadoc "http://java.sun.com/j2se/1.4.2/docs/api/index.html">
[...]
ourbook.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY Chapter1 SYSTEM "chapter1.xml">
<!ENTITY % entities SYSTEM "../entities.ent">
%entities;
]>
<book>
[...]
&Chapter1;
[...]
chapter1.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<chapter id="chapter1">
[..]
<para>Further information can be looked up at &javadoc;</para>
[...]
Is there any way to get Oxygen validate this structure?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

One option is to add all the files that you want to validate to the same <oXygen/> project created in the Project view, select them one by one with Ctrl + left click in the Project view, right-click and select Validate selection with .... In the dialog which is displayed select the schema / DTD used to validate the files. You can find the DocBook DTD in [oXygen-install-folder]/frameworks/docbook/dtd, so you don't have to browse remotely for it (press the Browse for local file button, not the Browse for remote file one). If you want to validate all the files of the project with one action just right-click on the project root and execute Validate selection with .... Please note that this action is available starting with version 7.0 of <oXygen/>.

Other option which works also in previous versions of <oXygen/> is to include the chapter files into the main book file using XInclude instead of entity references. This allows you to include a DOCTYPE / schema declaration in every file which enables you to validate each one individually.

Regards,
Sorin
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Adding to what Sorin said: you need to create a DTD that includes the DocBook DTD and the new entity declarations and perform the external validation against that DTD. Also you can perform the association with this DTD externally using the default schema associations from options, for instance you can associate this DTD with the document having the root element chapter.

Best Regards,
George
J.Raab
Posts: 2
Joined: Wed Feb 01, 2006 2:21 pm

Post by J.Raab »

I tried your solution, George, and it works perfectly. Thanks a lot!

Best Regards,
Jeannine
Post Reply