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

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

Closed
MarcusVonBergen opened this issue Jul 24, 2024 · 7 comments · Fixed by #464
Assignees
Labels
acknowledged in work bug Something isn't working Schemas generated schemata for xml, JSON and rdf or XMI

Comments

@MarcusVonBergen
Copy link

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

@MarcusVonBergen MarcusVonBergen added the bug Something isn't working label Jul 24, 2024
@mristin
Copy link
Collaborator

mristin commented Jul 24, 2024

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.

@BirgitBoss BirgitBoss added the Schemas generated schemata for xml, JSON and rdf or XMI label Jul 24, 2024
@JoergNeidig JoergNeidig added the acknowledged in work label Jul 24, 2024
@s-heppner
Copy link
Collaborator

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

@BirgitBoss
Copy link
Collaborator

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

@s-heppner
Copy link
Collaborator

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
Copy link
Contributor

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
Copy link
Author

MarcusVonBergen commented Aug 2, 2024

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:

  • Take the AAS XML (I used a v2.0 Bosch example saved it with the AAS Package Explorer to leverage it to v3.0 and resolved the idshort convention changes from v2.0 to v3.0):
    AAS.xml.txt

  • This is one of the tools I used to validate the XSD: https://www.freeformatter.com/xml-validator-xsd.html

  • This XSD (currently on GitHub) leads to the error:
    AAS.xsd.txt

  • This is the modified XSD that defines the environment tag as xs:element. Using this the validation succeeds:
    AAS_new.xsd.txt

I hope I could resolve unclarities.
Kind regards
Marcus

s-heppner added a commit that referenced this issue Aug 30, 2024
Previously we did not define `aas:environment`
directly via an `xs:element` tag, rather only
provided it directly as `xs:complexType`.
This created issues with several XML Schema
validator engines.

This commit fixes this problem,
discovered in #457.
@s-heppner
Copy link
Collaborator

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?

s-heppner added a commit that referenced this issue Nov 15, 2024
Previously we did not define `aas:environment`
directly via an `xs:element` tag, rather only
provided it directly as `xs:complexType`.
This created issues with several XML Schema
validator engines.

This commit fixes this problem,
discovered in #457.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged in work bug Something isn't working Schemas generated schemata for xml, JSON and rdf or XMI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants