onvif / specs

ONVIF Network Interface Specifications
Other
339 stars 91 forks source link

'##any' result in ambiguous model when importing devicemgmt.wsdl in Visual Studio #320

Closed Guerout-Arnaud closed 1 year ago

Guerout-Arnaud commented 1 year ago

Hi, sorry to bother. I'm facing some issues importing devicemgmt.wsdl into a project into Visual Studio.

I've just created a new ConsoleApp (C#) to experiment a bit with the protocol and see what's possible to do with it yet the import of the wsdl fails. To import the file I follow these few steps :

In the Status output i get the following : Warning: One or more errors occurred. (details)

There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 7996 Column: 8\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:Source', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 224 Column: 8\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:Weight', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 230 Column: 5\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:Extension', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 8970 Column: 4\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:VertexLimits', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 8007 Column: 5\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:Filter', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 7973 Column: 5\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:Source', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 6465 Column: 5\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:AFModes', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 543 Column: 5\r\n   Validation Error: Wildcard '##targetNamespace' allows element 'http://www.onvif.org/ver10/schema:SceneOrientationMode', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 462 Column: 5\r\n   Validation Error: Wildcard '##any' allows element 'http://www.onvif.org/ver10/schema:Transmittance', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 410 Column: 5\r\n   Validation Error: Wildcard '##targetNamespace' allows element 'http://www.onvif.org/ver10/schema:SceneOrientation', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 13 Column: 3\r\n   Validation Error: The attributeGroup 'http://www.w3.org/XML/1998/namespace:specialAttrs' has already been declared.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 12 Column: 3\r\n   Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:id' has already been declared.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 11 Column: 3\r\n   Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:base' has already been declared.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 3 Column: 3\r\n   Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:space' has already been declared.
There was a validation error on a schema generated during export:\r\n    Source: \r\n    Line: 2 Column: 3\r\n   Validation Error: The global attribute 'http://www.w3.org/XML/1998/namespace:lang' has already been declared.

Theses error mostly occurs in onvif.xsd and common,xsd and are due to ##any being used concurrently with optional parameters.

Is there anything I can do on my side to fix these errors ? If I can't do anything, would it be possible to fix these errors please ? Thanks by advance

HansBusch commented 1 year ago

Microsoft tool is using XML schema 1.0 while ONVIF uses 1.1. Unfortunately we are not aware of any switch to tell it to use XML schema version 1.1

Luckily you can safely ignore this kind of errors since the tool still creates correct code.

Guerout-Arnaud commented 1 year ago

Hi Hans. Thanks for your informations. I'll try it and close this issue if i don't have anything else related.

Guerout-Arnaud commented 1 year ago

Hi @HansBusch. I still have some issue with the wsdl beiing written in xml 1.1.
The first thing is that the file is tagged as xml 1.0 and not 1.1. Even if the file was correctly tagged, i haven't been able to find any XML 1.1 compliant library. Would it be possible to have xml 1.0 compliant wsdl ? Or is there any way to modify the current wsld to make them 1.0 compllant (without breaking the license) ? Thanks by advance

HansBusch commented 1 year ago

Please refer to https://www.w3.org/TR/xmlschema11-1/ for the rationale why both 1.1 and 1.0 use the same schema url.

XML 1.0 has a serious extensibility issue that has been fixed with 1.1. For that reason ONVIF has switched to XML 1.1 many years ago.