[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook] xi:include problem
On Thu, 2013-12-12 at 06:14 -0500, Dew, Simon wrote: > Hi Shaun > > On 11/12/2013 14:38, Shaun McCance wrote: > > > Are there any specific problems you've seen with 2.7.8? I have a machine > > with 2.7.7 and have no problems with the DocBook schemas. I did just > > file a patch for a bug I ran across with using choice in name classes > > for attributes, but the DocBook schemas don't use that. > > Sorry for the delay in replying, it's been a while since I looked at this. > > The problem I was seeing with xmllint was spurious error messages if the > docbook file was incorrect. There's a docbook file here: > > https://dl.dropboxusercontent.com/u/865332/Errors.docbook > > Line 36 contains an incorrect attribute, perhaps a result of author > error, or a botched transformation from an imported source file. > > xmllint ver 2.7.8 (on Windows 7 Ultimate, 32-bit) gives: > > > xmllint --noout --relaxng %DOCBOOK_XML%\rng\docbook.rng Errors.docbook > > Errors.docbook:14: element info: Relax-NG validity error : Did not > expect element info there > Errors.docbook:14: element info: Relax-NG validity error : Element book > has extra content: info > Errors.docbook fails to validate > > ...which is unhelpful, or maybe just plain wrong. Ah, right. I have seen this as well, not just with DocBook but with other schemas as well. It's not wrong per se. It's just not giving the most useful error. Basically, if you have a problem within the info element, then the entire info element doesn't match the pattern, so it gets reported as invalid. In my experience, this only happens when the wrapper element (info in this case) is optional. I've written scripts in the past that make certain optional elements mandatory to make it easier to spot the real error. I've looked into fixing this before, but the solution wasn't obvious to me. (I'm not the libxml2 maintainer, just an occasional drive-by bug fixer.) You could still use xmllint to handle XInclude, outputting to a temp file, and use jing for validation. (Sadly, jing doesn't seem to handle pipes.) Although one of the nice things about using xmllint for the whole shebang is that it internally tracks the file that elements come from, and reports the actual file name and line number of the error (when it gets the location of the error right). -- Shaun
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]