Closed GiancarloFusiello closed 5 years ago
Comparing https://relaxng.org/relaxng.rng and https://relaxng.org/spec-20011203.html, they both say:
<define name="grammar-content">
<interleave><ref name="other"/><zeroOrMore><choice>
<ref name="start-element"/>
<ref name="define-element"/>
<element name="div"><ref name="common-atts"/><ref name="grammar-content"/></element>
<element name="include"><attribute name="href"><data type="anyURI"/></attribute><ref name="common-atts"/><ref name="include-content"/></element>
</choice></zeroOrMore></interleave></define>
giving 3 valid alternatives to start
; e.g. https://github.com/libero/schemas/blob/master/api/content/item.rng has both include
s and define
s. What is an example of a .rng
that is missing start
and should have it?
Worth noting that Section 5 in https://relaxng.org/spec-20011203.html states:
After applying all the rules in Section 4, the schema will match the following grammar:
<grammar> <start> top </start> define* </grammar>
which makes start
mandatory after e.g. all include
s have been resolved.
Unclear to me whether libxml2
(the C library that lxml
binds to) implements this simplification process itself or not.
http://gnome-lib.996298.n3.nabble.com/Possibly-incomplete-step-4-7-of-the-RELAXNG-simplification-process-td27643.html seems to say so, but no official documentation.
Current error from lxml
is: lxml.etree.RelaxNGParseError: Element <grammar> has no <start>, line 6
My best guess so far, looking at the <start>
elements all being in tests/
, is that the <grammar>
s in api/
, core/
, extensions/
are not for direct use for validation, but only a library to build your own schema. The schema is then dependent on the journal. If this hypothesis is correct, <grammar>
s without a <start>
are only allowed if they are to be included in other <grammar>
s.
For example, the 3 documents in https://github.com/libero/schemas/tree/master/tests/api/content/item are examples of how a item
can be configured to be. So there should be a missing step here of building the elife-style schema (it may be elsewhere but that uses Schematron).
@thewilkybarkid Can you confirm if @giorgiosironi is correct above?
My best guess so far, looking at the
<start>
elements all being intests/
, is that the<grammar>
s inapi/
,core/
,extensions/
are not for direct use for validation, but only a library to build your own schemas.
Is the right answer. The idea is that the documents are your own, they just have a top-level requirement (eg /libero:item/libero:meta
).
This is complex though, so part of #153 is rethinking this entirely...
Is the right answer. The idea is that the documents are your own, they just have a top-level requirement (eg
/libero:item/libero:meta
).This is complex though, so part of #153 is rethinking this entirely...
@thewilkybarkid When you have completed your investigation, can you please update https://github.com/libero/libero/issues/161 with the process for validation?
So, I agree this should be closed once https://github.com/libero/libero/issues/161 is up-to-date.
Going to close now since it's not a bug.
The RelaxNG schema files that reside in the libero/schemas repository are missing the
start
element/tag under thegrammar
element/tag. According to the RelaxNG schema this tag is required.I discovered this issue when trying to use the schemas for validation in another project but I'm surprised this was not picked up by the schema tests indicating that the testing method may need to be revised.
Fix: