Package org.apache.xerces.impl.validation

Examples of org.apache.xerces.impl.validation.InvalidDatatypeValueException


        } else {
            minOk = (!isMinInclusiveDefined && !isMinExclusiveDefined);
        }

        if (!(minOk && maxOk))
            throw new InvalidDatatypeValueException (
                             getErrorString(DatatypeMessageProvider.OutOfBounds,
                                  DatatypeMessageProvider.MSG_NONE,
                                      new Object [] { Float.toString(d) ,  lowerBound ,
                                          upperBound, lowerBoundIndicator, upperBoundIndicator}));
View Full Code Here


    private void enumCheck(float v) throws InvalidDatatypeValueException {
       for (int i = 0; i < fEnumFloats.length; i++) {
           if (v == fEnumFloats[i]) return;
       }
       throw new InvalidDatatypeValueException(
                                              getErrorString(DatatypeMessageProvider.NotAnEnumValue,
                                                             DatatypeMessageProvider.MSG_NONE,
                                                             new Object [] { new Float(v)}));
   }
View Full Code Here

    }

    private  void checkContent( String content )throws InvalidDatatypeValueException {
        if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
                if ( fRegex == null || fRegex.matches( content) == false )
                    throw new InvalidDatatypeValueException("Value'"+content+
                                                            "does not match regular expression facet" + fPattern );
            }


            float f = 0;
            try {
                //System.out.println("content = " + content );
                f = Float.valueOf(content).floatValue();
                //System.out.println("f = " + f );
            } catch (NumberFormatException nfe) {
                if( content.equals("INF") ){
                    f=Float.POSITIVE_INFINITY;
                } else if( content.equals("-INF") ){
                    f=Float.NEGATIVE_INFINITY;
                } else if( content.equals("NaN" ) ) {
                    f=Float.NaN;
                } else {
                    throw new InvalidDatatypeValueException(
                                  getErrorString(DatatypeMessageProvider.NotFloat,
                                                 DatatypeMessageProvider.MSG_NONE,
                                                           new Object [] { content}));
                }
            }
View Full Code Here

     */
    public void validate(String content, Object state ) throws InvalidDatatypeValueException{

        boolean status;
        if ((status = XMLChar.isValidName(content) ) == false) {//Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
            InvalidDatatypeValueException error =  new
                                                   InvalidDatatypeValueException( content );
            error.setKeyIntoReporter( "IDInvalid" );
            throw error;
        }
        if (!addId( content)) { //It is OK to pass a null here
            InvalidDatatypeValueException error =
            new InvalidDatatypeValueException( content );
            error.setKeyIntoReporter( "IDNotUnique" );
            throw error;
        }
    }
View Full Code Here

    public void validate(String content, Object state)
    throws InvalidDatatypeValueException {
            if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
                if ( fRegex == null || fRegex.matches( content) == false )
                    throw new InvalidDatatypeValueException("Value'"+content+
                                                            "does not match regular expression facet" + fPattern );
            }


            double d = 0.0;
            try {
                d = Double.valueOf(content).doubleValue();
            } catch (NumberFormatException nfe) {
                throw new InvalidDatatypeValueException(
                                                       getErrorString(DatatypeMessageProvider.NotReal,
                                                                      DatatypeMessageProvider.MSG_NONE,
                                                                      new Object [] { content}));
            }
            boundsCheck(d);
View Full Code Here

        } else {
            minOk = (!isMinInclusiveDefined && !isMinExclusiveDefined);
        }

        if (!(minOk && maxOk))
            throw new InvalidDatatypeValueException (
                                                    getErrorString(DatatypeMessageProvider.OutOfBounds,
                                                                   DatatypeMessageProvider.MSG_NONE,
                                                                   new Object [] { Double.toString(d) ,  lowerBound ,
                                                                       upperBound, lowerBoundIndicator, upperBoundIndicator}));
View Full Code Here

    private void enumCheck(double v) throws InvalidDatatypeValueException {
        for (int i = 0; i < fEnumDoubles.length; i++) {
            if (v == fEnumDoubles[i]) return;
        }
        throw new InvalidDatatypeValueException(
                                               getErrorString(DatatypeMessageProvider.NotAnEnumValue,
                                                              DatatypeMessageProvider.MSG_NONE,
                                                              new Object [] { new Double(v)}));
    }
View Full Code Here

    {
        URI             uriContent = null;

            if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
                if ( fRegex == null || fRegex.matches( content) == false )
                    throw new InvalidDatatypeValueException("Value '"+content+
                                                            "' does not match regular expression facet" + fPattern );
            }

          
            try {
                if( content.trim().length() != 0 ) //Validate non null URI
                    uriContent = new URI( content );
                //else it is valid anyway
               
            } catch URI.MalformedURIException ex ) {
                throw new InvalidDatatypeValueException("Value '"+content+
                                                                           "' is a Malformed URI ");

            }

    }
View Full Code Here

    * @see         org.apache.xerces.validators.datatype.InvalidDatatypeValueException
    */
   public void validate(String content, Object state ) throws InvalidDatatypeValueException{
      //Pass content as a String
      if (!XMLChar.isValidName(content)) {//Check if is valid key
         InvalidDatatypeValueException error = new InvalidDatatypeValueException( content );//Need Message
         error.setKeyIntoReporter( "IDREFInvalid" );
         throw error;//Need Message
      }
      addIdRef( content, state);// We are storing IDs
   }
View Full Code Here

      while (en.hasMoreElements()) {
         String key = (String)en.nextElement();
         if ( this.fTableOfId == null || ! this.fTableOfId.containsKey(key)) {

            InvalidDatatypeValueException error =  new
                                                   InvalidDatatypeValueException( key );
            error.setKeyIntoReporter("MSG_ELEMENT_WITH_ID_REQUIRED" );
            throw error;
         }
      }

   } // checkIdRefs()
View Full Code Here

TOP

Related Classes of org.apache.xerces.impl.validation.InvalidDatatypeValueException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.