@Override
    public void validateDefault(InputProblemReporter rep, boolean normalize)
        throws XMLStreamException
    {
        String defValue = mDefValue.getValue();
        int len = defValue.length();

        // Then code similar to actual value validation:
        StringBuilder sb = null;
        int count = 0;
        int start = 0;

        main_loop:
        while (start < len) {
            char c = defValue.charAt(start);

            // Ok, any white space to skip?
            while (true) {
                if (!WstxInputData.isSpaceChar(c)) {
                    break;
                }
                if (++start >= len) {
                    break main_loop;
                }
                c = defValue.charAt(start);
            }

            int i = start+1;

            do {
                if (++i >= len) {
                    break;
                }
                c = defValue.charAt(i);
            } while (!WstxInputData.isSpaceChar(c));
            ++count;
            String token = defValue.substring(start, i);
            int illegalIx = WstxInputData.findIllegalNmtokenChar(token, mCfgNsAware, mCfgXml11);
            if (illegalIx >= 0) {
                reportValidationProblem(rep, "Invalid default value '"+defValue
                                        +"'; character #"+illegalIx+" ("
                                        +WstxInputData.getCharDesc(defValue.charAt(illegalIx))
                                        +") not a valid NMTOKENS character");
            }

            if (normalize) {
                if (sb == null) {
                    sb = new StringBuilder(i - start + 32);
                } else {
                    sb.append(' ');
                }
                sb.append(token);
            }
            start = i+1;
        }

        if (count == 0) {
            reportValidationProblem(rep, "Invalid default value '"+defValue
                                    +"'; empty String is not a valid NMTOKENS value");
            return;
        }

        if (normalize) {
            mDefValue.setValue(sb.toString());
        }
    }
@ Override public void validateDefault ( InputProblemReporter rep , boolean normalize ) throws XMLStreamException { String defValue = mDefValue . getValue ( ) ; int len = defValue . length ( ) ; StringBuilder sb = null ; int count = 0 ; int start = 0 ; main_loop : while ( start < len ) { char c = defValue . charAt ( start ) ; while ( true ) { if ( ! WstxInputData . isSpaceChar ( c ) ) { break ; } if ( ++ start >= len ) { break main_loop ; } c = defValue . charAt ( start ) ; } int i = start + 1 ; do { if ( ++ i >= len ) { break ; } c = defValue . charAt ( i ) ; } while ( ! WstxInputData . isSpaceChar ( c ) ) ; ++ count ; String token = defValue . substring ( start , i ) ; int illegalIx = WstxInputData . findIllegalNmtokenChar ( token , mCfgNsAware , mCfgXml11 ) ; if ( illegalIx >= 0 ) { reportValidationProblem ( rep , "Invalid default value '" + defValue + "'; character #" + illegalIx + " (" + WstxInputData . getCharDesc ( defValue . charAt ( illegalIx ) ) + ") not a valid NMTOKENS character" ) ; } if ( normalize ) { if ( sb == null ) { sb = new StringBuilder ( i - start + 32 ) ; } else { sb . append ( ' ' ) ; } sb . append ( token ) ; } start = i + 1 ; } if ( count == 0 ) { reportValidationProblem ( rep , "Invalid default value '" + defValue + "'; empty String is not a valid NMTOKENS value" ) ; return ; } if ( normalize ) { mDefValue . setValue ( sb . toString ( ) ) ; } }
Method called by the validator
to ask attribute to verify that the default it has (if any) is
valid for such type.