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