LIBXML validation does not work in 14.1?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
stilor
Posts: 6
Joined: Tue Jan 29, 2013 8:50 am

LIBXML validation does not work in 14.1?

Post by stilor »

Hi,

I am using 14.1, build 2012121012. I tried to set up validation scenario using LIBXML (I am using XPointer scheme, so I need LIBXML). I am working with DocBook 4 document.

When the document is valid, it is correctly displayed as valid. However, if the document is not valid, the Info tab shows the following messages (among a lot of garbage about using catalogs for resolution):

Code: Select all


[LIBXML] ch_foo.xml:56: element sect1: validity error : Element sect1 does not follow the DTD, ...
...
[LIBXML] Process LIBXML exit code = 3
Yet, oXygen shows the document as valid - green light at the status bar at the bottom says "Document is valid". Even if I go to this error message and click it, oXygen does not take me to the element which is causing the issue.

So, I think there are three issues here:
1) oXygen does not detect a failure from LIBXML (anything other than "exit status = 0" should be considered an error, according to libxml's documentation);
2) The error message from LIBXML does not navigate to the element causing it;
3) Could the output from LIBXML be made less verbose? It is hard to find an error line among all the debugging messages.

Example debug messages:

Code: Select all


Executing: "C:\Program Files (x86)\Oxygen XML Editor 14/xmllint"  --noout --catalogs --xinclude --postvalid C:\documents\sample.xml
Resolve: pubID -//OASIS//DTD DocBook XML V4.5//EN sysID http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
4524 Parsing catalog C:/cygwin/home/Alexey/userdocs/share/catalog.xml
C:/documents/share/catalog.xml added to file hash
Using rewriting rule http://www.oasis-open.org/docbook/xml/4.5/
...
Catalogs cleanup
Free catalog entry http://docbook.sourceforge.net/release/xsl/current/
Free catalog entry http://docbook.sourceforge.net/release/xsl/current/
Free catalog entry http://www.w3.org/Math/DTD/mathml2/
Radu
Posts: 9448
Joined: Fri Jul 09, 2004 5:18 pm

Re: LIBXML validation does not work in 14.1?

Post by Radu »

Hi,

In the Oxygen Preferences->Editor / Custom Validation Engines page you can find the place where the external LIBXML validation engine is pre-configured.
I created a single validation scenario with a single validation unit which uses LIBXML. Then I used that single scenario to validate the XML file using the toolbar "Validate" action (as automatic validation cannot be done using external engines which read the content directly from disk). The reported errors were detected and localized in the small sample I created.
Would it be possible for you to put together a sample Docbook project on which the issue can be reproduced? You can send it to support@oxygenxml.com.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
stilor
Posts: 6
Joined: Tue Jan 29, 2013 8:50 am

Re: LIBXML validation does not work in 14.1?

Post by stilor »

I was able to reproduce it. The key point is that the sources are in a different directory from the project file - if they are in the same dir, validation works as expected.

Here is an example. The files are laid out as follows:

\projects
--- a.xpr
\sources
--- book.xml
--- ch_overview.xml

When you open a.xpr and try to validate the top-level element (book.xml), it shows the document as valid. But if you scroll the 'Info' log, you'll see that there is a validation error reported against ch_overview.xml and the LIBXML exit code is 3, not 0. If you open the ch_overview.xml and run validation on it, error is detected correctly.

However, I was wrong about the "spam messages" and navigation - it is that oXygen does not detect error, which is why it does not create 'Errors' tab, and navigation does not work from the 'Info' tab. The only real issue is why it does not detect the validation error.

book.xml:

Code: Select all


<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'">
]>
<book>
<bookinfo>
<title>Sample Book</title>
</bookinfo>
<xi:include href="ch_overview.xml"/>
</book>
ch_overview.xml (note that the chapter is empty - violates element model for <chapter/>):

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'">
]>
<chapter>
<title>Overview</title>
</chapter>
a.xpr:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<project version="14.1">
<meta>
<filters directoryPatterns="CVS" filePatterns="" positiveFilePatterns="" showHiddenFiles="false"/>
<options>
<serialized version="14.1" xml:space="preserve">
<map>
<entry>
<String>validation.scenario.associations</String>
<scenarioAssociation-array>
<scenarioAssociation>
<field name="url">
<String>../sources/book.xml</String>
</field>
<field name="scenarioIds">
<list>
<String>LIBXML</String>
</list>
</field>
<field name="scenarioTypes">
<list>
<String>Validation_scenario</String>
</list>
</field>
</scenarioAssociation>
</scenarioAssociation-array>
</entry>
<entry>
<String>validation.scenarios</String>
<validationScenario-array>
<validationScenario>
<field name="pairs">
<list>
<validationUnit>
<field name="validationType">
<validationUnitType>
<field name="validationInputType">
<String>text/xml</String>
</field>
</validationUnitType>
</field>
<field name="url">
<String>${currentFileURL}</String>
</field>
<field name="validationEngine">
<validationEngine>
<field name="engineType">
<String>LIBXML</String>
</field>
<field name="allowsAutomaticValidation">
<Boolean>false</Boolean>
</field>
</validationEngine>
</field>
<field name="allowAutomaticValidation">
<Boolean>false</Boolean>
</field>
<field name="extensions">
<null/>
</field>
<field name="validationSchema">
<null/>
</field>
</validationUnit>
</list>
</field>
<field name="type">
<String>Validation_scenario</String>
</field>
<field name="name">
<String>LIBXML</String>
</field>
</validationScenario>
</validationScenario-array>
</entry>
</map>
</serialized>
</options>
</meta>
<projectTree name="a.xpr">
<file name="../sources/book.xml"/>
</projectTree>
</project>
Radu
Posts: 9448
Joined: Fri Jul 09, 2004 5:18 pm

Re: LIBXML validation does not work in 14.1?

Post by Radu »

Hi Alexey,

Thanks for the samples. I managed to reproduce the problem on my side and it will be fixed in Oxygen 14.2 (in a couple of weeks).

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9448
Joined: Fri Jul 09, 2004 5:18 pm

Re: LIBXML validation does not work in 14.1?

Post by Radu »

Hi Alexey,

Oxygen 14.2 was just release and should contain the fix we discussed.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply