Package org.apache.xerces.impl.validation.datatypes.regex

Examples of org.apache.xerces.impl.validation.datatypes.regex.Match


            iConstraint = ((Number)constraint) . intValue();
         }
      } catch (ClassCastException e) {
         return null;
      }
      Match m = new Match();
      if ( ! decodeNonIntegerRE . matches( s , m ) ) {
         return null;
      }
      int scale = m . getCapturedText( 2 ) . length();
      if ( scale > iConstraint ) {
         return null;
      }
      return new Integer( scale );
   }
View Full Code Here


    On return, the values of these fields have been set to the numbers appropriate to the string.
    THEREFORE, if validate is called again, reset() should be called unless you want to know
    whether the second argument has the same syntactic restrictions as the first.
   */
   public boolean validate(Object obj) {
      Match m = new Match();
      if ( ! ( obj instanceof String ) ) {
         return false;
      }
      String str = (String) obj;
      if (!numberRE.matches(str, m)) {
View Full Code Here

    On return, the values of these fields have been set to the numbers appropriate to the string.
    THEREFORE, if validate is called again, reset() should be called unless you want to know
    whether the second argument has the same syntactic restrictions as the first.
   */
   public boolean validate(String str) {
      Match m = new Match();
      if (!numberRE.matches(str, m)) {
         return false;
      }
      // first make sure that value is in range, if bounds are set
      if (!super.validate( str )) {
View Full Code Here

   public String getComponent(String request) {
      NamedMatch nm = (NamedMatch) stack.elementAt(0);
      // If this is what we're looking for return text.
      String currentMatchName = nm.getName();
      Vector currentMatchSubParts = (Vector) ht.get(currentMatchName);
      Match match = nm.getMatch();
      if (!request.startsWith("$")) {
         request = "$" + request;
      }
      if (currentMatchName.equals(request)) {
         return match.getCapturedText(0);
      }
//          if ( basicParts.indexOf(currentMatchName) >= 0 ){
//              return null;
//          }
      //Search inside
      int i;
      for (i = 0; i < match.getNumberOfGroups()-1; i++) {
         String str = match.getCapturedText(i+1);
         if (str == null) {
            continue;
         }
         // next is $name
         String ithSubMatchName = (String) currentMatchSubParts.elementAt(i);
         Match m = new Match();
         RegularExpression re = (RegularExpression) ht.get(ithSubMatchName + "RE");
         if (re == null) {
            continue;
         }
         if (!re.matches(str, m)) {
View Full Code Here

   public boolean validateAs(String str, String type) {
      if ( str.length() == 0 ) {
         return false;
      }
      stack.removeAllElements();
      Match m = new Match();
      stack.insertElementAt(new NamedMatch("$" + type, m), 0);
      RegularExpression re = (RegularExpression )ht.get("$" + type + "RE");
      return valid = re.matches(str, m);
   }
View Full Code Here

      try {
         s = (String)obj;
      } catch (ClassCastException e) {
         return null;
      }
      Match m = new Match();
      if ( ! decodeNonIntegerRE . matches( s , m ) ) {
         return null;
      }
      if ( m . getBeginning( 0 ) != 0 || // match whole string
           m . getEnd( 0 ) != s . length() ||
           m . getCapturedText( 1 ) . length() + m . getCapturedText( 2 ) . length() == 0 ) {
         return null;
      }
      return Boolean.TRUE;
   }
View Full Code Here

            iConstraint = ((Number)constraint) . intValue();
         }
      } catch (ClassCastException e) {
         return null;
      }
      Match m = new Match();
      if ( ! decodeNonIntegerRE . matches( s , m ) ) {
         return null;
      }
      int prec = m . getCapturedText( 1 ) . length() + m . getCapturedText( 2 ) . length();
      if ( prec > iConstraint ) {
         return null;
      }
      return new Integer( prec );
   }
View Full Code Here

      }
      */
   }
   /** Determines whether str is a valid ISO8601 date */
   public boolean matchDate(String str) {
      dateMatch = new Match();
      date = false;
      if (ISO8601Pattern.calendarRE.matches(str, dateMatch)) {
         date = rep.mergeCalendarDate(dateMatch);
      } else if ( ISO8601Pattern.ordinalRE.matches(str, dateMatch) ) {
         date = rep.mergeOrdinalDate(dateMatch);
View Full Code Here

      }
      return isDate();
   }
   /** Determines whether str is a valid ISO8601 time */
   public boolean matchTime(String str) {
      timeMatch = new Match();
      time = false;
      if (ISO8601Pattern.$timeRE.matches(str, timeMatch)) {
         time = true;
         time = rep.mergeTime( timeMatch );
      }
View Full Code Here

TOP

Related Classes of org.apache.xerces.impl.validation.datatypes.regex.Match

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.