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