01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.xerces.impl.dv.dtd;
19:
20: import org.apache.xerces.impl.dv.*;
21:
22: /**
23: * <P>ENTITYDatatypeValidator implements the
24: * DatattypeValidator interface.
25: * This validator embodies the ENTITY attribute type
26: * from XML1.0 recommendation.
27: * The Value space of ENTITY is the set of all strings
28: * that match the NCName production and have been
29: * declared as an unparsed entity in a document
30: * type definition.
31: * The Lexical space of Entity is the set of all
32: * strings that match the NCName production.
33: * The value space of ENTITY is scoped to a specific
34: * instance document.</P>
35: *
36: * @xerces.internal
37: *
38: * @author Jeffrey Rodriguez, IBM
39: * @author Sandy Gao, IBM
40: *
41: * @version $Id: ENTITYDatatypeValidator.java 446749 2006-09-15 21:51:23Z mrglavas $
42: */
43: public class ENTITYDatatypeValidator implements DatatypeValidator {
44:
45: // construct an ENTITY datatype validator
46: public ENTITYDatatypeValidator() {
47: }
48:
49: /**
50: * Checks that "content" string is valid ID value.
51: * If invalid a Datatype validation exception is thrown.
52: *
53: * @param content the string value that needs to be validated
54: * @param context the validation context
55: * @throws InvalidDatatypeException if the content is
56: * invalid according to the rules for the validators
57: * @see InvalidDatatypeValueException
58: */
59: public void validate(String content, ValidationContext context)
60: throws InvalidDatatypeValueException {
61:
62: if (!context.isEntityUnparsed(content))
63: throw new InvalidDatatypeValueException(
64: "ENTITYNotUnparsed", new Object[] { content });
65:
66: }
67:
68: }
|