Docbook 4 validation + Xinclude + Duplicate ID problem

Having trouble installing Oxygen? Got a bug to report? Post it all here.
peter.acs
Posts: 3
Joined: Wed Mar 31, 2010 9:55 am
Location: Budapest
Contact:

Docbook 4 validation + Xinclude + Duplicate ID problem

Post by peter.acs »

Hello,

I am using docbook 4.4 documents in a modular system, including modules (sections) into a central master book file for validation and deliverable production, using Xinclude.

The standard validation scenario does not report duplicate IDs as an error, if the duplicates occur in two different included files. The FOP process fails on the duplicate ID.

Can I modify the validation scenario to detect such duplicates as an error?

Thanks,
Peter
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Docbook 4 validation + Xinclude + Duplicate ID problem

Post by adrian »

Hello,

You can validate the XIncluded modules in the context of the main document if you create a custom validation scenario (Document Validate -> Configure Validation Scenario) in which you specify the main document(New -> Add -> Browse for the main document) and select the LIBXML processor. Afterwards you can associate this custom validation scenario with the needed documents by selecting them in the Project view(assuming you have them in a project) and choosing 'Configure Validation Scenario' from the Project contextual menu.

The problem with this LIBXML custom validation scenario is that you will no longer have "Validate as you type". It is greyed out for external processors like LIBXML. So you will have to save and validate manually(Document -> Validate -> Validate Document Ctrl+Shift+V) the child documents.

Let me know if you need further clarification.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
peter.acs
Posts: 3
Joined: Wed Mar 31, 2010 9:55 am
Location: Budapest
Contact:

Re: Docbook 4 validation + Xinclude + Duplicate ID problem

Post by peter.acs »

Thanks to you I was able to change validation to use LIBXML, but now I get the following error for the master file and each included file:

Code: Select all

Description:  warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
I tried to add some LIBXML (xmllint) command line parameters in the oXygen configuration based on googling the error, but could not resolve the problem.
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Docbook 4 validation + Xinclude + Duplicate ID problem

Post by adrian »

Hello,

It should have worked out-of-the-box as Oxygen comes with preconfigured catalogs for DocBook(including 4.2 and 4.4), unless you somehow deactivated them. The catalogs you need are provided by the DocBook 4 document type(Options -> Preferences -> Document type Association). So first make sure that document type is activated(the checkbox should be set). And if you edit it, you should see in the catalogs tab: ${frameworks}/docbook/catalog.xml

LIBXML comes preconfigured to use the Oxygen catalogs so you shouln't have to change anything.

If all else fails or if you want to avoid the Docbook 4 document type for some reason, you can add its catalog to the Oxygen's global catalog configuraton(Options -> Preferences -> XML -> XML Catalog). Press New and use this URL: ${frameworks}/docbook/catalog.xml

Let me know if any of these helped.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
peter.acs
Posts: 3
Joined: Wed Mar 31, 2010 9:55 am
Location: Budapest
Contact:

Re: Docbook 4 validation + Xinclude + Duplicate ID problem

Post by peter.acs »

Thank you Adrian,

After messing with the settings you defined with no success I reinstalled oXygen and now LIBXML works perfectly, so apparently there was an error in my configuration.

I assume there is no way to reproduce such behaviour with the internal validator and thus have also "validate as you type" working.

Peter
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Docbook 4 validation + Xinclude + Duplicate ID problem

Post by sorin_ristache »

peter.acs wrote:I assume there is no way to reproduce such behaviour with the internal validator and thus have also "validate as you type" working.
No, it is not possible to catch such validation errors with the internal validator because in case of DTDs it validates each module that is included with XInclude before resolving the XInclude reference. The validation against a DTD takes place before resolving the XInclude references so a duplicate ID in a different module cannot be detected by the internal validator. In case of DocBook 5 documents which are validated against a Relax NG schema such errors can be detected also with the internal validator because in case of Relax NG schemas (and in case of XSD schemas) the validation takes place after resolving XIncludes.


Regards,
Sorin
Post Reply