1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.impl.dv.dtd;
  23 
  24 import com.sun.org.apache.xerces.internal.impl.dv.*;
  25 import com.sun.org.apache.xerces.internal.util.XML11Char;
  26 
  27 /**
  28  * NMTOKEN datatype validator for NMTokens from XML 1.1.
  29  *
  30  * @xerces.internal
  31  *
  32  * @author Jeffrey Rodriguez, IBM
  33  * @author Sandy Gao, IBM
  34  * @author Neil Graham, IBM
  35  *
  36  */
  37 public class XML11NMTOKENDatatypeValidator extends NMTOKENDatatypeValidator {
  38 
  39     // construct a NMTOKEN datatype validator
  40     public XML11NMTOKENDatatypeValidator() {
  41         super();
  42     }
  43 
  44     /**
  45      * Checks that "content" string is valid NMTOKEN value.
  46      * If invalid a Datatype validation exception is thrown.
  47      *
  48      * @param content       the string value that needs to be validated
  49      * @param context       the validation context
  50      * @throws InvalidDatatypeException if the content is
  51      *         invalid according to the rules for the validators
  52      * @see InvalidDatatypeValueException
  53      */
  54     public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException {
  55         if (!XML11Char.isXML11ValidNmtoken(content)) {
  56            throw new InvalidDatatypeValueException("NMTOKENInvalid", new Object[]{content});
  57        }
  58    }
  59 
  60 } // class XML11NMTOKENDatatypeValidator