-
Notifications
You must be signed in to change notification settings - Fork 28
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
TypeError - Unexpected top-level list aas:assetAdministrationShells on line 3 #190
Comments
The error message appears in line 1432 of xml_deserialization.py If I understand line 1421 correctly, it will prepend The output for the error message is beautified using _element_pretty_identifier() from line 95 which translates the element name back to the prefix So, the only difference I see is that the XML document defines In that case, the error message is misleading and it should say: "You are trying to open an AASX file version 1, but the Python SDK can only open AASX files of version 3.". |
Previously, if the elements of an XML document are part of an unknown namespace, this would lead to cryptic error messages such as: Unexpected top-level list aas:assetAdministrationShells on line 3 where, the correct expected element is indeed aas:assetAdministrationShells, leaving the user wondering about what could possibly be wrong. The only difference is the namespace, which isn't part of the error message, because it gets replaced by the prefix. To improve the error messages in this case, a check that compares the namespaces declared on the document against the ones required by the deserialization, and errors if a required namespace isn't declared. Partially fix eclipse-basyx#190
Previously, the namespace of an element would always be replaced by its prefix if the prefix is known. However, this turned out to mask errors in case the namespace is different from the one used by our SDK. Thus, the function `_element_pretty_identifier()` is adjusted such that it only replaces the namespace if it matches one of the namespaces known to our SDK. Partially fix eclipse-basyx#190 See also: 79a8635
Yep, the error messages definitely aren't helpful in this case! I created #191, which checks the declared namespaces prior to deserialization and also only replaces the namespace by its prefix in error messages if the namespace is the same as the one expected by our SDK. |
Previously, if the elements of an XML document are part of an unknown namespace, this would lead to cryptic error messages such as: Unexpected top-level list aas:assetAdministrationShells on line 3 where, the correct expected element is indeed aas:assetAdministrationShells, leaving the user wondering about what could possibly be wrong. The only difference is the namespace, which isn't part of the error message, because it gets replaced by the prefix. To improve the error messages in this case, a check that compares the namespaces declared on the document against the ones required by the deserialization, and errors if a required namespace isn't declared. Partially fix #190
Previously, the namespace of an element would always be replaced by its prefix if the prefix is known. However, this turned out to mask errors in case the namespace is different from the one used by our SDK. Thus, the function `_element_pretty_identifier()` is adjusted such that it only replaces the namespace if it matches one of the namespaces known to our SDK. Partially fix #190 See also: 79a8635
Previously, if the elements of an XML document are part of an unknown namespace, this would lead to cryptic error messages such as: Unexpected top-level list aas:assetAdministrationShells on line 3 where, the correct expected element is indeed aas:assetAdministrationShells, leaving the user wondering about what could possibly be wrong. The only difference is the namespace, which isn't part of the error message, because it gets replaced by the prefix. To improve the error messages in this case, a check that compares the namespaces declared on the document against the ones required by the deserialization, and errors if a required namespace isn't declared. Partially fix eclipse-basyx#190
Previously, the namespace of an element would always be replaced by its prefix if the prefix is known. However, this turned out to mask errors in case the namespace is different from the one used by our SDK. Thus, the function `_element_pretty_identifier()` is adjusted such that it only replaces the namespace if it matches one of the namespaces known to our SDK. Partially fix eclipse-basyx#190 See also: 79a8635
Previously, if the elements of an XML document are part of an unknown namespace, this would lead to cryptic error messages such as: Unexpected top-level list aas:assetAdministrationShells on line 3 where, the correct expected element is indeed aas:assetAdministrationShells, leaving the user wondering about what could possibly be wrong. The only difference is the namespace, which isn't part of the error message, because it gets replaced by the prefix. To improve the error messages in this case, a check that compares the namespaces declared on the document against the ones required by the deserialization, and errors if a required namespace isn't declared. Partially fix #190
Previously, the namespace of an element would always be replaced by its prefix if the prefix is known. However, this turned out to mask errors in case the namespace is different from the one used by our SDK. Thus, the function `_element_pretty_identifier()` is adjusted such that it only replaces the namespace if it matches one of the namespaces known to our SDK. Partially fix #190 See also: 79a8635
Previously, if the elements of an XML document are part of an unknown namespace, this would lead to cryptic error messages such as: Unexpected top-level list aas:assetAdministrationShells on line 3 where, the correct expected element is indeed aas:assetAdministrationShells, leaving the user wondering about what could possibly be wrong. The only difference is the namespace, which isn't part of the error message, because it gets replaced by the prefix. To improve the error messages in this case, a check that compares the namespaces declared on the document against the ones required by the deserialization, and errors if a required namespace isn't declared. Partially fix eclipse-basyx/basyx-python-sdk#190
Previously, the namespace of an element would always be replaced by its prefix if the prefix is known. However, this turned out to mask errors in case the namespace is different from the one used by our SDK. Thus, the function `_element_pretty_identifier()` is adjusted such that it only replaces the namespace if it matches one of the namespaces known to our SDK. Partially fix eclipse-basyx/basyx-python-sdk#190 See also: 79a86352bb52b1528a9bf9c860331915b4db7556
Previously, if the elements of an XML document are part of an unknown namespace, this would lead to cryptic error messages such as: Unexpected top-level list aas:assetAdministrationShells on line 3 where, the correct expected element is indeed aas:assetAdministrationShells, leaving the user wondering about what could possibly be wrong. The only difference is the namespace, which isn't part of the error message, because it gets replaced by the prefix. To improve the error messages in this case, a check that compares the namespaces declared on the document against the ones required by the deserialization, and errors if a required namespace isn't declared. Partially fix eclipse-basyx/basyx-python-sdk#190
Previously, the namespace of an element would always be replaced by its prefix if the prefix is known. However, this turned out to mask errors in case the namespace is different from the one used by our SDK. Thus, the function `_element_pretty_identifier()` is adjusted such that it only replaces the namespace if it matches one of the namespaces known to our SDK. Partially fix eclipse-basyx/basyx-python-sdk#190 See also: 79a86352bb52b1528a9bf9c860331915b4db7556
Background
I'm trying to open the AASX example files from https://admin-shell-io.com/samples/ Unfortunately, those files all suffer from Bug 666 and Bug 681 of AAS Package Explorer. I fixed those bugs in the files manually.
My issue
I'm now trying to open the fixed files with basxy-python-sdk. As recommended in issue #189, I am using
failsafe=False
to open the files in order to detect the bugs above.With the failsafe flag, however, I get the following error:
The only place I can imagine that this refers to is the XML document which starts like this:
If line 1 is the XML declaration, line 2 is
aasenv
and line 3 isassetAdministrationShells
. But why would it be unexpected? Chapter 5.3.9 of the Metamodel specification defines a[0..*]
relationship between environment and asset administration shell. Isn't that what I'm seeing in the XML file?If I'd like to manually fix the file, what would I need to do?
The text was updated successfully, but these errors were encountered: