Beispiel #1
0
 /**
  * Check whether a given input string is valid according to this SimpleType
  *
  * @param value the input string to be checked
  * @param nsResolver a namespace resolver used to resolve namespace prefixes if the type is
  *     namespace sensitive. The value supplied may be null; in this case any namespace-sensitive
  *     content will throw an UnsupportedOperationException.
  * @param nameChecker XML 1.0 or 1.1 name checker, for types such as xs:NCName
  * @throws UnsupportedOperationException if the type is namespace-sensitive and no namespace
  *     resolver is supplied
  */
 public ValidationFailure validateContent(
     CharSequence value, NamespaceResolver nsResolver, NameChecker nameChecker) {
   SimpleType base = getItemType();
   StringTokenIterator iter = new StringTokenIterator(value.toString());
   ValidationFailure result = null;
   int count = 0;
   // try {
   while (true) {
     StringValue val = (StringValue) iter.next();
     if (val == null) break;
     count++;
     ValidationFailure v = base.validateContent(val.getStringValue(), nsResolver, nameChecker);
     if (v != null) {
       return v;
     }
   }
   //        } catch (ValidationException err) {
   //            result = err;
   //        } catch (XPathException err) {
   //            result = new ValidationException(err);
   //        }
   if (count == 0) {
     result =
         new ValidationFailure(
             "The built-in list type "
                 + StandardNames.getDisplayName(fingerprint)
                 + " does not allow a zero-length list");
   }
   return result;
 }
Beispiel #2
0
 /**
  * Get the display name of the type: that is, a lexical QName with an arbitrary prefix
  *
  * @return a lexical QName identifying the type
  */
 public String getDisplayName() {
   return StandardNames.getDisplayName(fingerprint);
 }