You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If i navigate in the schema, i found unsolved references or not complete resolved types, but the method getUnsolvedReferences() shows no entry.
Expected behavior
There are no unsolved references
Library Version
1.2.8
Additional context
I found some different problems, it happend with the latest merges where you adjust some of the pr and not merged all stuff.
Problem: XsdAttribute are not supporting XsdBuiltInTypes -> solution: in class XsdAttribute add in constructor: if(XsdParserCore.getXsdTypesToJava().containsKey(type)) { HashMap<String, String> attributes = new HashMap<>(); attributes.put(NAME_TAG, type); this.simpleType = ReferenceBase.createFromXsd(new XsdBuiltInDataType(parser, attributes, this)); }
Problem: XsdAttributeGroup can't resolve attributes -> solution: in class XsdAttributeGroup add in method replaceUnsolvedElements: if(element.getElement() instanceof XsdAttribute) { for(int i = 0; i < attributes.size(); i++) { ReferenceBase attributesUnsolvedReference = attributes.get(i); if(attributesUnsolvedReference instanceof UnsolvedReference && (((UnsolvedReference) attributesUnsolvedReference).getRef().substring(((UnsolvedReference) attributesUnsolvedReference).getRef().indexOf(":") + 1).equals(element.getName()))) { attributes.set(i, element); break; } } }
Problem XsdUnion doesn't resolve correct memberTypes: solution -> in class XsdParserCore method resolveMemberTypes:
move XsdSchema schema = union.getXsdSchema(); back into the for loop. Otherwise you will override the schema if you use a import schema and then use the original one. If it's to expensive to calculate the original schema on each memberType you can use a temp variable inside the for loop to not override the original schema.
Problem schemas with imports, which includes other schemas are not supported at all: Solution: -> you need to include all transitive dependencies in the imports as well so in code XsdParserCore method resolveOtherNamespaceRefs you need the method findTransitiveDependencies and fill your relevantElements with this elements as well.
I get some unsolved references, when i resolve memberTypes in union with transitiv includes, why do we need a the clone in the getElementFromSchema() method? This can produce unsolved references too, if you remove this all works fine.
I've released a new version 1.2.9. It contains the suggestions for your first three points.
Regarding 4: I've added a test base on your description and your test files, it might be fixed with the changes in this new version because I didn't get the behavior you've described.
Regarding 5: The cloned elements had an issue where they were both adding UnsolvedReferences in the elementCopy constructor call and then again in the clone method, hence the loose UnsolvedReferences at the end of the parsing, even though all elements have the references solved. This version also solves the cases I've could identity where that happens.
Please check the new version and if the issues persist let me know.
Describe the bug
If i navigate in the schema, i found unsolved references or not complete resolved types, but the method getUnsolvedReferences() shows no entry.
Expected behavior
There are no unsolved references
Library Version
1.2.8
Additional context
I found some different problems, it happend with the latest merges where you adjust some of the pr and not merged all stuff.
Problem: XsdAttribute are not supporting XsdBuiltInTypes -> solution: in class XsdAttribute add in constructor:
if(XsdParserCore.getXsdTypesToJava().containsKey(type)) { HashMap<String, String> attributes = new HashMap<>(); attributes.put(NAME_TAG, type); this.simpleType = ReferenceBase.createFromXsd(new XsdBuiltInDataType(parser, attributes, this)); }
Problem: XsdAttributeGroup can't resolve attributes -> solution: in class XsdAttributeGroup add in method replaceUnsolvedElements:
if(element.getElement() instanceof XsdAttribute) { for(int i = 0; i < attributes.size(); i++) { ReferenceBase attributesUnsolvedReference = attributes.get(i); if(attributesUnsolvedReference instanceof UnsolvedReference && (((UnsolvedReference) attributesUnsolvedReference).getRef().substring(((UnsolvedReference) attributesUnsolvedReference).getRef().indexOf(":") + 1).equals(element.getName()))) { attributes.set(i, element); break; } } }
Problem XsdUnion doesn't resolve correct memberTypes: solution -> in class XsdParserCore method resolveMemberTypes:
move XsdSchema schema = union.getXsdSchema(); back into the for loop. Otherwise you will override the schema if you use a import schema and then use the original one. If it's to expensive to calculate the original schema on each memberType you can use a temp variable inside the for loop to not override the original schema.
Problem schemas with imports, which includes other schemas are not supported at all: Solution: -> you need to include all transitive dependencies in the imports as well so in code XsdParserCore method resolveOtherNamespaceRefs you need the method findTransitiveDependencies and fill your relevantElements with this elements as well.
I get some unsolved references, when i resolve memberTypes in union with transitiv includes, why do we need a the clone in the getElementFromSchema() method? This can produce unsolved references too, if you remove this all works fine.
testdata.zip
Attach the XSD file or a similar example that you are trying to parse.
The text was updated successfully, but these errors were encountered: