KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > dtd > XML11DTDValidator


1 /*
2  * Copyright 1999-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.dtd;
18
19 import org.apache.xerces.impl.Constants;
20 import org.apache.xerces.xni.parser.XMLComponentManager;
21
22 /**
23  * This allows the validator to correctlyhandle XML 1.1
24  * documents.
25  *
26  * @xerces.internal
27  *
28  * @author Neil Graham
29  * @version $Id: XML11DTDValidator.java,v 1.7 2004/10/04 21:57:30 mrglavas Exp $
30  */

31 public class XML11DTDValidator extends XMLDTDValidator {
32
33     //
34
// Constants
35
//
36

37     protected final static String JavaDoc DTD_VALIDATOR_PROPERTY =
38         Constants.XERCES_PROPERTY_PREFIX+Constants.DTD_VALIDATOR_PROPERTY;
39
40     //
41
// Constructors
42
//
43

44     /** Default constructor. */
45     public XML11DTDValidator() {
46
47         super();
48     } // <init>()
49

50     // overridden so that this class has access to the same
51
// grammarBucket as the corresponding DTDProcessor
52
// will try and use...
53
public void reset(XMLComponentManager manager) {
54         XMLDTDValidator curr = null;
55         if((curr = (XMLDTDValidator)manager.getProperty(DTD_VALIDATOR_PROPERTY)) != null &&
56                 curr != this) {
57             fGrammarBucket = curr.getGrammarBucket();
58         }
59         super.reset(manager);
60     } //reset(XMLComponentManager)
61

62     protected void init() {
63         if(fValidation || fDynamicValidation) {
64             super.init();
65             // now overwrite some entries in parent:
66

67             try {
68                 fValID = fDatatypeValidatorFactory.getBuiltInDV("XML11ID");
69                 fValIDRef = fDatatypeValidatorFactory.getBuiltInDV("XML11IDREF");
70                 fValIDRefs = fDatatypeValidatorFactory.getBuiltInDV("XML11IDREFS");
71                 fValNMTOKEN = fDatatypeValidatorFactory.getBuiltInDV("XML11NMTOKEN");
72                 fValNMTOKENS = fDatatypeValidatorFactory.getBuiltInDV("XML11NMTOKENS");
73
74             }
75             catch (Exception JavaDoc e) {
76                 // should never happen
77
e.printStackTrace(System.err);
78             }
79         }
80     } // init()
81

82 } // class XML11DTDValidator
83
Popular Tags