xmlet / XsdParser

A Parser that parses a XSD file into a Java Structure.
MIT License
80 stars 34 forks source link

Unsolved References are not correct #60

Closed darthweiter closed 8 months ago

darthweiter commented 8 months ago

Describe the bug The Unsolved References are not correct and there are multiple problems i encountered. 1.: the transitive includes are not correct, but there is a fix -> https://github.com/xmlet/XsdParser/issues/58 2.: the includes are not considered on imported files, so they aren't resolved example: a.xsd A import b.xsd B b.xsd include c.xsd C so if a.xsd use type B:TypeFrom C they are not include 3.: the unsolved elements are not always using the correct filename, they use the last filename in the parser. So the Problem is, there are unsolved elements shown under filenames, that doesn't exist

Expected behavior There are no Unsolved References.

Library Version 1.2.7

Additional context Attach the XSD file or a similar example that you are trying to parse. if i try to parse the BBK_RIAD_V2.4-SDMX.xsd, i encountered the Problem.

darthweiter commented 8 months ago

relates to https://github.com/xmlet/XsdParser/issues/58

lcduarte commented 8 months ago

I've rejected the PR but I've implemented some of the ideas that were there. The need for that method that clears and rebuilds the UnsolvedReferences is wrong because it only hides the problem instead of solving it at its origin, but after spending quite a bit of time trying the understand why that code solves the issue I couldn't find it. It will probably become a permanent "temporary" solution 😄

I've released a new version, 1.2.8, with the code for this issue.

darthweiter commented 8 months ago

All Right, and yeah it doesn't solve the problem at the root. The idea of the clear of the unsolved reference is to fix the wrong filepath and build it from the right XsdSchema of them, so all unsolved elements have the correct filepath so you can resolve them as normal. I tested it with the sdmx-schemas and there was UnsolvedReference ItemWhere in SDMXDataGenericTimeSeries, but there was no such element present in this file. In the Method addUnsolvedReference, you use the currentFilePath if no schema is present. But this looks like not correct, i think this is the last file you used with the parser but i havn't found the root problem.

I will look into 1.2.8 :)