admin-shell-io / aas-specs

Repository of the Asset Administration Shell Specification IDTA-01001 - Metamodel
https://admin-shell-io.github.io/aas-specs-antora/index/home/index.html
Creative Commons Attribution 4.0 International
47 stars 26 forks source link

[BUG] environment tag should be declared as "xs:element" instead of "xs:group" in AAS.xsd #457

Open MarcusVonBergen opened 1 month ago

MarcusVonBergen commented 1 month ago

When validating v3.0 AAS XML files against AAS.xsd I get the error that the tag environment is not declared. Digging deeper the error is occurring because in the schema file (XSD), the tag "environment" is defined as an "xs:group" instead of "xs:element" which is supposed to be root. The root element of an XML document should always be defined as an "xs:element" in the XSD file like this in our example: <xs:element name="environment"> Changing the XSD accordingly resolves my validation errors. I attached the new XSD file (as txt as GitHub does not support xsd) with the ask to adjust the changes in the project. AAS_xsd.txt

mristin commented 1 month ago

Thanks, @MarcusVonBergen ! @s-heppner can you please double-check, maybe also with other teams?

All the XSD engines I tested with (Python, C#) worked with the current schema.

s-heppner commented 1 month ago

Hi @MarcusVonBergen, can you please tell me which XSD validator you used so that I can try to reproduce the issue?

BirgitBoss commented 1 month ago

I do not know but perhaps this is also related to https://github.com/admin-shell-io/aas-test-engines/issues/43? I also get an error when validating an xml file with the test engine

s-heppner commented 1 month ago

I do not think this is connected to admin-shell-io/aas-test-engines#43, since it seems that the XML schema check passes on these files.

sebbader-sap commented 1 month ago

Hi @MarcusVonBergen, can you please tell me which XSD validator you used so that I can try to reproduce the issue?

We are using, for instance, https://www.freeformatter.com/xml-validator-xsd.html and the Visual Studio Code "XML" extension from Red Hat.

MarcusVonBergen commented 1 month ago

Hi everyone, thank you for your quick answers and sorry for my late one. I used an online validator as well as a validation tool that is part of the SAP Integration Suite which builds on top of Apache Camel. Both listed me the same error stating that it cannot find the declaration of the element 'environment' from line 1. To reproduce the issue do the following:

I hope I could resolve unclarities. Kind regards Marcus

s-heppner commented 1 week ago

I can confirm that there are XML Schema validators that need the root of an XSD to be an xs:element. This shouldn't break any other XML Schema validators, as it is valid XSD.

Therefore, I've adapted the XSD Schema file to include an xs:element definition of aas:environment in this PR: #464.

@MarcusVonBergen could you please see if the new XSD schema fixes the problems you have?