KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > dv > dtd > ENTITYDatatypeValidator


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.impl.dv.dtd;
18
19 import org.apache.xerces.impl.dv.*;
20
21 /**
22  * <P>ENTITYDatatypeValidator implements the
23  * DatattypeValidator interface.
24  * This validator embodies the ENTITY attribute type
25  * from XML1.0 recommendation.
26  * The Value space of ENTITY is the set of all strings
27  * that match the NCName production and have been
28  * declared as an unparsed entity in a document
29  * type definition.
30  * The Lexical space of Entity is the set of all
31  * strings that match the NCName production.
32  * The value space of ENTITY is scoped to a specific
33  * instance document.</P>
34  *
35  * @xerces.internal
36  *
37  * @author Jeffrey Rodriguez, IBM
38  * @author Sandy Gao, IBM
39  *
40  * @version $Id: ENTITYDatatypeValidator.java,v 1.9 2004/10/06 14:56:51 mrglavas Exp $
41  */

42 public class ENTITYDatatypeValidator implements DatatypeValidator {
43
44     // construct an ENTITY datatype validator
45
public ENTITYDatatypeValidator() {
46     }
47
48     /**
49      * Checks that "content" string is valid ID value.
50      * If invalid a Datatype validation exception is thrown.
51      *
52      * @param content the string value that needs to be validated
53      * @param context the validation context
54      * @throws InvalidDatatypeException if the content is
55      * invalid according to the rules for the validators
56      * @see InvalidDatatypeValueException
57      */

58     public void validate(String JavaDoc content, ValidationContext context) throws InvalidDatatypeValueException {
59
60         if (!context.isEntityUnparsed(content))
61             throw new InvalidDatatypeValueException("ENTITYNotUnparsed", new Object JavaDoc[]{content});
62             
63     }
64     
65 }
66
Popular Tags