Martijn Faassen | 9 Sep 2005 17:40
Favicon

Re: Repeating RelaxNG validation

Robert Kern wrote:

> I'm in the process of testing hooks for reporting libxml2's so-called
> "structured errors" in lxml. Among other things, I want to get a more
> diagnostic message when a document fails to validate against a RelaxNG
> schema.
> 
> I ran across a problem where an invalid document will fail the
> validation the first time but succeed when the validation is repeated. I
> haven't been able to isolate a small test case, unfortunately; my
> attempts at simplification give the expected results.
> 
> I am on OS X 10.4 using lxml pristine from SVN, libxml2 2.6.20 and
> libxslt 1.1.14 (note: these are *not* the ones that come with the OS but
> the problem exists there, too).
> 
> Attached are the RelaxNG schema, the invalid document, and a failing
> unit test. I hope they're not too large for the list. I apologize in
> advance if they are. FYI: the invalid element is
> /notebook/sheet/ipython-block/para on line 18.

Hey,

I can reproduce this, but am at a loss. It may point to a problem with 
libxml2 itself. It is of course possible this bug got fixed in 2.6.21 
that was released recently, though on the other hand I don't see any 
mention of Relax NG fixes in the release notes.

Would you be willing to write a C version of this and post a message to 
the libxml2 mailing list? If not, let me know, and I'll try to write a C 
(Continue reading)

Robert Kern | 10 Sep 2005 04:58
Favicon

Re: Repeating RelaxNG validation

Martijn Faassen wrote:

> Would you be willing to write a C version of this and post a message to
> the libxml2 mailing list? If not, let me know, and I'll try to write a C
> version and report it myself.

Yup, it's a libxml2 bug. Apply the attached patch to testRelax.c in the
libxml2-2.6.21 distribution (possibly earlier ones, too).

[test]$ ~/src/libxml2-2.6.21/testRelax nbk.rng tut-2.3.5-bad.nbk
tut-2.3.5-bad.nbk:17: element ipython-block: Relax-NG validity error :
Expecting element ipython-cell, got para
tut-2.3.5-bad.nbk:17: element ipython-block: Relax-NG validity error :
Element ipython-block failed to validate content
Relax-NG validity error : Extra element ipython-block in interleave
tut-2.3.5-bad.nbk:17: element ipython-block: Relax-NG validity error :
Element sheet failed to validate content
tut-2.3.5-bad.nbk fails to validate
tut-2.3.5-bad.nbk validates

The same problem occurs with the pair of files
test/relaxng/docbook{.rng,_0.xml} from the libxml2 source distribution.

--

-- 
Robert Kern
rkern <at> ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
(Continue reading)

Kasimier Buchcik | 12 Sep 2005 13:56
Picon
Favicon

Re: Re: Repeating RelaxNG validation

Hi,

On Fri, 2005-09-09 at 19:58 -0700, Robert Kern wrote:
> Martijn Faassen wrote:
> 
> > Would you be willing to write a C version of this and post a message to
> > the libxml2 mailing list? If not, let me know, and I'll try to write a C
> > version and report it myself.
> 
> Yup, it's a libxml2 bug. Apply the attached patch to testRelax.c in the
> libxml2-2.6.21 distribution (possibly earlier ones, too).

[...]

Daniel Veillard wants to ship a new release today, since there was
as API breaker somewhere in 2.6.21... so if you send the patch to
libxml2, it might get into the this release.

Regards,

Kasimier
Martijn Faassen | 12 Sep 2005 15:40
Favicon

Re: Re: Repeating RelaxNG validation

Kasimier Buchcik wrote:
> On Fri, 2005-09-09 at 19:58 -0700, Robert Kern wrote:
> 
>>Martijn Faassen wrote:
>>
>>
>>>Would you be willing to write a C version of this and post a message to
>>>the libxml2 mailing list? If not, let me know, and I'll try to write a C
>>>version and report it myself.
>>
>>Yup, it's a libxml2 bug. Apply the attached patch to testRelax.c in the
>>libxml2-2.6.21 distribution (possibly earlier ones, too).

Thanks for doing this work, Robert!

> 
> [...]
> 
> Daniel Veillard wants to ship a new release today, since there was
> as API breaker somewhere in 2.6.21... so if you send the patch to
> libxml2, it might get into the this release.
> 

I think the patch only demonstrates the problem and does not fix it. 
That said, Kasimier's suggestion to Robert to report this to the libxml2 
developers still stands. (I haven't checked bugzilla but can't find 
anything on the libxml2 mailing list on this right now)

Regards,

(Continue reading)

Robert Kern | 12 Sep 2005 21:51
Favicon

Re: Repeating RelaxNG validation

Martijn Faassen wrote:

> I think the patch only demonstrates the problem and does not fix it.
> That said, Kasimier's suggestion to Robert to report this to the libxml2
> developers still stands. (I haven't checked bugzilla but can't find
> anything on the libxml2 mailing list on this right now)

I submitted it it bugzilla.

--

-- 
Robert Kern
rkern <at> ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

Gmane