author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 44797 | jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/AbstractXMLSchema.java@8b3b3b911b8a |
child 47359 | e1a6c0168741 |
permissions | -rw-r--r-- |
12005 | 1 |
/* |
2 |
* reserved comment block |
|
3 |
* DO NOT REMOVE OR ALTER! |
|
4 |
*/ |
|
5 |
/* |
|
44797
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
6 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
7 |
* contributor license agreements. See the NOTICE file distributed with |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
8 |
* this work for additional information regarding copyright ownership. |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
9 |
* The ASF licenses this file to You under the Apache License, Version 2.0 |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
10 |
* (the "License"); you may not use this file except in compliance with |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
11 |
* the License. You may obtain a copy of the License at |
12005 | 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 |
||
22 |
package com.sun.org.apache.xerces.internal.jaxp.validation; |
|
23 |
||
24 |
import java.util.HashMap; |
|
25 |
||
26 |
import javax.xml.validation.Schema; |
|
27 |
import javax.xml.validation.Validator; |
|
28 |
import javax.xml.validation.ValidatorHandler; |
|
29 |
||
30 |
/** |
|
31 |
* <p>Abstract implementation of Schema for W3C XML Schemas.</p> |
|
32 |
* |
|
33 |
* @author Michael Glavassevich, IBM |
|
34 |
*/ |
|
35 |
abstract class AbstractXMLSchema extends Schema implements |
|
36 |
XSGrammarPoolContainer { |
|
37 |
||
38 |
/** |
|
39 |
* Map containing the initial values of features for |
|
40 |
* validators created using this grammar pool container. |
|
41 |
*/ |
|
42 |
private final HashMap fFeatures; |
|
43 |
||
17534 | 44 |
/** |
45 |
* Map containing the initial values of properties for |
|
46 |
* validators created using this grammar pool container. |
|
47 |
*/ |
|
48 |
private final HashMap fProperties; |
|
49 |
||
12005 | 50 |
public AbstractXMLSchema() { |
51 |
fFeatures = new HashMap(); |
|
17534 | 52 |
fProperties = new HashMap(); |
12005 | 53 |
} |
54 |
||
55 |
/* |
|
56 |
* Schema methods |
|
57 |
*/ |
|
58 |
||
59 |
/* |
|
60 |
* @see javax.xml.validation.Schema#newValidator() |
|
61 |
*/ |
|
62 |
public final Validator newValidator() { |
|
63 |
return new ValidatorImpl(this); |
|
64 |
} |
|
65 |
||
66 |
/* |
|
67 |
* @see javax.xml.validation.Schema#newValidatorHandler() |
|
68 |
*/ |
|
69 |
public final ValidatorHandler newValidatorHandler() { |
|
70 |
return new ValidatorHandlerImpl(this); |
|
71 |
} |
|
72 |
||
73 |
/* |
|
74 |
* XSGrammarPoolContainer methods |
|
75 |
*/ |
|
76 |
||
77 |
/** |
|
78 |
* Returns the initial value of a feature for validators created |
|
79 |
* using this grammar pool container or null if the validators |
|
80 |
* should use the default value. |
|
81 |
*/ |
|
82 |
public final Boolean getFeature(String featureId) { |
|
83 |
return (Boolean) fFeatures.get(featureId); |
|
84 |
} |
|
85 |
||
86 |
/* |
|
17534 | 87 |
* Set a feature on the schema |
12005 | 88 |
*/ |
17534 | 89 |
public final void setFeature(String featureId, boolean state) { |
12005 | 90 |
fFeatures.put(featureId, state ? Boolean.TRUE : Boolean.FALSE); |
91 |
} |
|
92 |
||
17534 | 93 |
/** |
94 |
* Returns the initial value of a property for validators created |
|
95 |
* using this grammar pool container or null if the validators |
|
96 |
* should use the default value. |
|
97 |
*/ |
|
98 |
public final Object getProperty(String propertyId) { |
|
99 |
return fProperties.get(propertyId); |
|
100 |
} |
|
101 |
||
102 |
/* |
|
103 |
* Set a property on the schema |
|
104 |
*/ |
|
105 |
public final void setProperty(String propertyId, Object state) { |
|
106 |
fProperties.put(propertyId, state); |
|
107 |
} |
|
108 |
||
12005 | 109 |
} // AbstractXMLSchema |