ietf-wg-cellar / ebml-specification

the specification for the EBML format
Creative Commons Attribution 4.0 International
70 stars 24 forks source link

Potentially incorrect default value for maxOccurs in XSD #395

Closed nerg4l closed 3 years ago

nerg4l commented 3 years ago

In EBMLSchema.xsd the default value for maxOccurs is defined as 1.

The specification says the following about maxOccurs:

[...] If the maxOccurs attribute is not present, then there is no upper bound for the permitted number of occurrences of this EBML Element within its Parent Element or within the EBML Document, depending on whether or not the EBMLParentPath of the EBML Element is empty.

The semantic meaning of maxOccurs within an EBML Schema is analogous to the meaning of maxOccurs within an XML Schema; when it is not present, it's similar to xml:maxOccurs="unbounded" in an XML Schema.

In my opinion the XSD definition could be misleading. I propose to define maxOccurs as a union type or define 0 as a special value.

In case maxOccurs is defined as a union type:

In case 0 is defined as a special value:

robUx4 commented 3 years ago

It does look like a bug indeed. I am not well versed in XSD but maybe @dericed knows more about this.

It does seem like it should have a default of unbounded and so the change would be your first proposal.

dericed commented 3 years ago

Yes a bug, the xsd says that if maxOccurs is not present then it implies maxOccurs="1", while the specification says that if maxOccurs is not present then it implies maxOccurs="unbounded". To be honest, I remember trying to define the element for storing "unbounded", but couldn't figure out how to make a non-negative-integer OR "unbounded" definition as @nerg4l has done.

As "unbounded" is common in XML Schemas, I prefer to use that rather than define 0 as a special case. The advantage of @nerg4l's first proposal is also that it would require a fix to the XSD but the rest of the specification is okay as is. @nerg4l would you mind submitting your first proposal as a PR?

dericed commented 3 years ago

@mcr, could you advise. @nerg4l identified a bug in Section 11.1.16. We haven't submitted an errata before, so could you share some guidance.

nerg4l commented 3 years ago

I will create a PR (you can expect it tomorrow afternoon CET). For this I checked the correct syntax for union types and I missed one xs:simpleType tag. The issue description was updated and now it contains that tag.

Also, I want to ask for some help in rewording Section 11.1.6.5 of the RFC. The PR will contain a draft but my English is quite broken.

robUx4 commented 3 years ago

BTW that XSD is used to validate the Matroska Schema we are developping. So this fix is very welcome ! Thanks a lot.

mcr commented 3 years ago

Please bring the PR up to the mailing list. Errata can be submitted on https://www.rfc-editor.org/info/rfc8794 --- pointing to this issue with a short summary, such as four points above would be great. It will go to the AD, who will then bring it back to the list, and we'll agree that it is a "hold for next revision". This issue should probably be marked "errata-rfc8794" or some such label, and left open.