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

Order of XSD schema's is unreliable #74

Closed
SimonCockx opened this issue Nov 12, 2024 · 1 comment
Closed

Order of XSD schema's is unreliable #74

SimonCockx opened this issue Nov 12, 2024 · 1 comment

Comments

@SimonCockx
Copy link
Contributor

Describe the bug
The order of parser.getResultXsdSchemas() is unreliable over different runs and different platforms, which is making some of my code produce output in an unreliable order. This is due to the underlying HashMap of parseElements:

    /**
     * A {@link List} which contains all the top elements parsed by this class.
     */
    public Map<String, List<ReferenceBase>> parseElements = new HashMap<>();

Note that the documentation is also out-of-date. It is not a list.

Expected behavior
I would like to iterate in the same order as the schema files were included, i.e., the main schema file first, followed by its first include (which can include schemas transitively), followed by its second include, etc.

Proposal: change parseElements to a LinkedHashSet, which respects insertion order:

public Map<String, List<ReferenceBase>> parseElements = new LinkedHashMap<>();

I can confirm that this would solve my issue.

Library Version
1.2.17

@lcduarte
Copy link
Member

Hello,

Thanks for the issue and the suggestion, I've created a new version with it, 1.2.18.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants