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

backport: adapter.xml: improve error messages in case of incorrect namespace declarations #192

Commits on Dec 19, 2023

  1. adapter.xml: verify declared namespaces before deserializing

    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
    jkhsjdhjs committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    2946b66 View commit details
    Browse the repository at this point in the history
  2. adapter.xml: improve element formatting in error messages

    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
    jkhsjdhjs committed Dec 19, 2023
    Configuration menu
    Copy the full SHA
    8351315 View commit details
    Browse the repository at this point in the history