src/main/java/org/xmlet/xsdparser/xsdelements/XsdElement.java
@Override
    public void replaceUnsolvedElements(NamedConcreteElement element) {
        super.replaceUnsolvedElements(element);

        XsdNamedElements elem = element.getElement();

        boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof XsdSimpleType;

        if (this.type instanceof UnsolvedReference && isComplexOrSimpleType && ((UnsolvedReference) this.type).getRef().equals(element.getName())){
            this.type = element;
            elem.setParent(this);
        }

        if (this.substitutionGroup instanceof UnsolvedReference && elem instanceof XsdElement && ((UnsolvedReference) this.substitutionGroup).getRef().equals(element.getName())){
            XsdElement xsdElement = (XsdElement) elem;

            this.type = xsdElement.type;
            this.simpleType = xsdElement.simpleType;
            this.complexType = xsdElement.complexType;
            this.substitutionGroup = element;
            elem.setParent(this);
        }
    }
@Override
    public void replaceUnsolvedElements(NamedConcreteElement element) {
        super.replaceUnsolvedElements(element);

        XsdNamedElements elem = element.getElement();

        boolean isComplexOrSimpleType = elem instanceof XsdComplexType || elem instanceof XsdSimpleType;

        if (this.type instanceof UnsolvedReference && isComplexOrSimpleType && ((UnsolvedReference) this.type).getRef().equals(element.getName())){
            this.type = element;
            elem.setParent(this);
        }

        if (this.substitutionGroup instanceof UnsolvedReference && elem instanceof XsdElement && ((UnsolvedReference) this.substitutionGroup).getRef().equals(element.getName())){
            XsdElement xsdElement = (XsdElement) elem;

            this.type = xsdElement.type;
            this.simpleType = xsdElement.simpleType;
            this.complexType = xsdElement.complexType;
            this.substitutionGroup = element;
            elem.setParent(this);
        }
    }
This method aims to replace the previously created {@link UnsolvedReference} in case that the type of the
current {@link XsdElement} instance is not a built-in type.
@param element A concrete element with a name that will replace the {@link UnsolvedReference} object created in the
{@link XsdElement} constructor. The {@link UnsolvedReference} is only replaced if there
is a match between the {@link UnsolvedReference#ref} and the {@link NamedConcreteElement#name}.