Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a2x should do syntax check using RelaxNG #27

Open
dagwieers opened this issue Feb 13, 2012 · 5 comments
Open

a2x should do syntax check using RelaxNG #27

dagwieers opened this issue Feb 13, 2012 · 5 comments

Comments

@dagwieers
Copy link
Owner

Now that we have xmllint patched for proper RelaxNG syntax checking, we might want to integrate RelaxNG syntax checking of content.xml before packaging.

However, since there are still some issues with the output that are not important, maybe only do this when -v is added ? And disregard the return code until we are safe :-)

@elextr
Copy link
Collaborator

elextr commented Feb 14, 2012

That should be easy, the backend can tell a2x to ignore the non-zero return code. The errors don't print unless verbose anyway but maybe we always want to print "Warning: xmllint found errors, continuing anyway"

@elextr
Copy link
Collaborator

elextr commented Feb 14, 2012

Committed possible implementation, I don't have hg a2x or patched xmllint so it is untested, use -L to disable, use backend-opt schema=path to set the schema to use.

@dagwieers
Copy link
Owner Author

Yesterday I did a rather deep investigation to the xmllint errors that are still apparent with our ODF output. I found that the OpenDocument RelaxNG schema actually seems to require a certain ordening of child-elements, e.g. for style:style parent element. The fact that xmllint (and even jing) do not make it very clear that this strict order is required makes the output confusing (and seemingly wrong). I opened a ticket during the investigation explaining the details: https://bugzilla.redhat.com/show_bug.cgi?id=790316

I also discovered that if a RelaxNG tool complains about interleave/interleaving, it basically has to do with the order of elements, and the output often is plain wrong. It complains about expecting the first element of the possible set (even if this element is not mandatory). So the error is incorrect and deceiving.

Jing is often somewhat better in the error output, but xmllint is more likely to be installed.

Now, with those issues resolved, xmllint return code is reliable, except that due to a bug in xmllint (unimplemented block for XML_RELAXNG_OPTIONAL) most, if not all, xmllint's in the field will fail to validate ODF documents. See: https://bugzilla.redhat.com/show_bug.cgi?id=752393

So we'll have to be very careful, maybe in a year or two most xmllint implementations have this bug fixed :-/

@dagwieers
Copy link
Owner Author

If the schema would not be that big, we could consider shipping it with asciidoc-odf...

@xamox
Copy link

xamox commented May 7, 2012

Thanks using a2x -L allowed it to work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants