src/main/java/org/xmlet/xsdparser/xsdelements/XsdSimpleType.java
public List<XsdRestriction> getAllRestrictions() {
        Map<String, XsdRestriction> restrictions = new HashMap<>();
        Map<String, String> xsdBuiltinTypes = XsdParserCore.getXsdTypesToJava();

        if (restriction != null){
            restrictions.put(xsdBuiltinTypes.get(restriction.getBase()), restriction);
        }

        if (union != null){
            union.getUnionElements().forEach(unionMember -> {
                XsdRestriction unionMemberRestriction = unionMember.getRestriction();

                if (unionMemberRestriction != null){
                    XsdRestriction existingRestriction = restrictions.getOrDefault(xsdBuiltinTypes.get(unionMemberRestriction.getBase()), null);

                    if (existingRestriction != null){
                        if (existsRestrictionOverlap(existingRestriction, unionMemberRestriction)){
                            throw new InvalidParameterException("The xsd file is invalid because has contradictory restrictions.");
                        }

                        updateExistingRestriction(existingRestriction, unionMemberRestriction);
                    } else {
                        restrictions.put(xsdBuiltinTypes.get(unionMemberRestriction.getBase()), unionMemberRestriction);
                    }
                }
            });
        }

        return new ArrayList<>(restrictions.values());
    }
public List<XsdRestriction> getAllRestrictions() {
        Map<String, XsdRestriction> restrictions = new HashMap<>();
        Map<String, String> xsdBuiltinTypes = XsdParserCore.getXsdTypesToJava();

        if (restriction != null){
            restrictions.put(xsdBuiltinTypes.get(restriction.getBase()), restriction);
        }

        if (union != null){
            union.getUnionElements().forEach(unionMember -> {
                XsdRestriction unionMemberRestriction = unionMember.getRestriction();

                if (unionMemberRestriction != null){
                    XsdRestriction existingRestriction = restrictions.getOrDefault(xsdBuiltinTypes.get(unionMemberRestriction.getBase()), null);

                    if (existingRestriction != null){
                        if (existsRestrictionOverlap(existingRestriction, unionMemberRestriction)){
                            throw new InvalidParameterException("The xsd file is invalid because has contradictory restrictions.");
                        }

                        updateExistingRestriction(existingRestriction, unionMemberRestriction);
                    } else {
                        restrictions.put(xsdBuiltinTypes.get(unionMemberRestriction.getBase()), unionMemberRestriction);
                    }
                }
            });
        }

        return new ArrayList<>(restrictions.values());
    }
public List < XsdRestriction > getAllRestrictions ( ) { Map < String , XsdRestriction > restrictions = new HashMap <> ( ) ; Map < String , String > xsdBuiltinTypes = XsdParserCore . getXsdTypesToJava ( ) ; if ( restriction != null ) { restrictions . put ( xsdBuiltinTypes . get ( restriction . getBase ( ) ) , restriction ) ; } if ( union != null ) { union . getUnionElements ( ) . forEach ( unionMember -> { XsdRestriction unionMemberRestriction = unionMember . getRestriction ( ) ; if ( unionMemberRestriction != null ) { XsdRestriction existingRestriction = restrictions . getOrDefault ( xsdBuiltinTypes . get ( unionMemberRestriction . getBase ( ) ) , null ) ; if ( existingRestriction != null ) { if ( existsRestrictionOverlap ( existingRestriction , unionMemberRestriction ) ) { throw new InvalidParameterException ( "The xsd file is invalid because has contradictory restrictions." ) ; } updateExistingRestriction ( existingRestriction , unionMemberRestriction ) ; } else { restrictions . put ( xsdBuiltinTypes . get ( unionMemberRestriction . getBase ( ) ) , unionMemberRestriction ) ; } } } ) ; } return new ArrayList <> ( restrictions . values ( ) ) ; }
This method obtains all the restrictions for the current {@link XsdSimpleType} element. It also joins multiple
restrictions with the same base attribute in the same {@link XsdRestriction} object, if a overlap doesn't occur.
In case of restriction overlap an exception is thrown because the information on the xsd file is contradictory.
@return A list of restrictions.
This method obtains all the restrictions for the current {