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
22package com.sun.org.apache.xerces.internal.impl.dtd;
23
24import com.sun.org.apache.xerces.internal.impl.Constants;
25import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
26
27/**
28 * This allows the validator to correctlyhandle XML 1.1
29 * documents.
30 *
31 * @xerces.internal
32 *
33 * @author Neil Graham
34 */
35public class XML11DTDValidator extends XMLDTDValidator {
36
37    //
38    // Constants
39    //
40
41    protected final static String DTD_VALIDATOR_PROPERTY =
42        Constants.XERCES_PROPERTY_PREFIX+Constants.DTD_VALIDATOR_PROPERTY;
43
44    //
45    // Constructors
46    //
47
48    /** Default constructor. */
49    public XML11DTDValidator() {
50
51        super();
52    } // <init>()
53
54    // overridden so that this class has access to the same
55    // grammarBucket as the corresponding DTDProcessor
56    // will try and use...
57    public void reset(XMLComponentManager manager) {
58        XMLDTDValidator curr = null;
59        if((curr = (XMLDTDValidator)manager.getProperty(DTD_VALIDATOR_PROPERTY)) != null &&
60                curr != this) {
61            fGrammarBucket = curr.getGrammarBucket();
62        }
63        super.reset(manager);
64    } //reset(XMLComponentManager)
65
66    protected void init() {
67        if(fValidation || fDynamicValidation) {
68            super.init();
69            // now overwrite some entries in parent:
70
71            try {
72                fValID       = fDatatypeValidatorFactory.getBuiltInDV("XML11ID");
73                fValIDRef    = fDatatypeValidatorFactory.getBuiltInDV("XML11IDREF");
74                fValIDRefs   = fDatatypeValidatorFactory.getBuiltInDV("XML11IDREFS");
75                fValNMTOKEN  = fDatatypeValidatorFactory.getBuiltInDV("XML11NMTOKEN");
76                fValNMTOKENS = fDatatypeValidatorFactory.getBuiltInDV("XML11NMTOKENS");
77
78            }
79            catch (Exception e) {
80                // should never happen
81                e.printStackTrace(System.err);
82            }
83        }
84    } // init()
85
86} // class XML11DTDValidator
87