Debian Codegraph @

src/main/java/com/ctc/wstx/msv/W3CSchema.java

raw
1 /* Woodstox XML processor
2 *
3 * Copyright (c) 2004- Tatu Saloranta, [email protected]
4 *
5 * Licensed under the License specified in the file LICENSE which is
6 * included with the source code.
7 * You may not use this file except in compliance with the License.
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 package com.ctc.wstx.msv;
17
18 import javax.xml.stream.*;
19
20 import org.codehaus.stax2.validation.*;
21
22 import com.sun.msv.grammar.xmlschema.XMLSchemaGrammar;
23 import com.sun.msv.verifier.regexp.xmlschema.XSREDocDecl;
24
25 /**
26 * This is a validation schema instance based on a W3C schema. It
27 * serves as a shareable "blueprint" for creating actual validator instances.
28 */
29 public class W3CSchema
30 implements XMLValidationSchema
31 {
32 protected final XMLSchemaGrammar mGrammar;
33
34 public W3CSchema(XMLSchemaGrammar grammar)
35 {
36 mGrammar = grammar;
37 }
38
39 @Override
40 public String getSchemaType() {
41 return XMLValidationSchema.SCHEMA_ID_W3C_SCHEMA;
42 }
43
44 @Override
45 public XMLValidator createValidator(ValidationContext ctxt)
46 throws XMLStreamException
47 {
48 XSREDocDecl dd = new XSREDocDecl(mGrammar);
49 return new GenericMsvValidator(this, ctxt, dd);
50 }
51 }