author | joehw |
Wed, 18 Oct 2017 13:25:49 -0700 | |
changeset 47359 | e1a6c0168741 |
parent 47216 | 71c04702a3d5 |
child 48409 | 5ab69533994b |
permissions | -rw-r--r-- |
12005 | 1 |
/* |
47359
e1a6c0168741
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. |
e1a6c0168741
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents:
47216
diff
changeset
|
3 |
* @LastModified: Oct 2017 |
12005 | 4 |
*/ |
5 |
/* |
|
27111
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
6 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
7 |
* contributor license agreements. See the NOTICE file distributed with |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
8 |
* this work for additional information regarding copyright ownership. |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
9 |
* The ASF licenses this file to You under the Apache License, Version 2.0 |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
10 |
* (the "License"); you may not use this file except in compliance with |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
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 |
||
27111
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
22 |
|
12005 | 23 |
package com.sun.org.apache.xerces.internal.impl.xs.models; |
24 |
||
25 |
import com.sun.org.apache.xerces.internal.impl.xs.SubstitutionGroupHandler; |
|
26 |
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaException; |
|
47359
e1a6c0168741
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents:
47216
diff
changeset
|
27 |
import com.sun.org.apache.xerces.internal.xni.QName; |
12005 | 28 |
import java.util.ArrayList; |
47359
e1a6c0168741
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents:
47216
diff
changeset
|
29 |
import java.util.List; |
12005 | 30 |
|
31 |
/** |
|
32 |
* XSEmptyCM is a derivative of the abstract content model base class that |
|
33 |
* handles a content model with no chilren (elements). |
|
34 |
* |
|
35 |
* This model validated on the way in. |
|
36 |
* |
|
37 |
* @xerces.internal |
|
38 |
* |
|
39 |
* @author Elena Litani, Lisa Martin |
|
40 |
* @author IBM |
|
41 |
*/ |
|
42 |
public class XSEmptyCM implements XSCMValidator { |
|
43 |
||
44 |
// |
|
45 |
// Constants |
|
46 |
// |
|
47 |
||
48 |
// start the content model: did not see any children |
|
49 |
private static final short STATE_START = 0; |
|
50 |
||
47359
e1a6c0168741
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents:
47216
diff
changeset
|
51 |
private static final List<Object> EMPTY = new ArrayList<>(0); |
12005 | 52 |
|
53 |
// |
|
54 |
// Data |
|
55 |
// |
|
56 |
||
57 |
// |
|
58 |
// XSCMValidator methods |
|
59 |
// |
|
60 |
||
61 |
/** |
|
62 |
* This methods to be called on entering a first element whose type |
|
63 |
* has this content model. It will return the initial state of the content model |
|
64 |
* |
|
65 |
* @return Start state of the content model |
|
66 |
*/ |
|
67 |
public int[] startContentModel(){ |
|
68 |
return (new int[] {STATE_START}); |
|
69 |
} |
|
70 |
||
71 |
||
72 |
/** |
|
73 |
* The method corresponds to one transaction in the content model. |
|
74 |
* |
|
75 |
* @param elementName the qualified name of the element |
|
76 |
* @param currentState Current state |
|
77 |
* @param subGroupHandler the substitution group handler |
|
78 |
* @return element index corresponding to the element from the Schema grammar |
|
79 |
*/ |
|
80 |
public Object oneTransition (QName elementName, int[] currentState, SubstitutionGroupHandler subGroupHandler){ |
|
81 |
||
82 |
// error state |
|
83 |
if (currentState[0] < 0) { |
|
84 |
currentState[0] = XSCMValidator.SUBSEQUENT_ERROR; |
|
85 |
return null; |
|
86 |
} |
|
87 |
||
88 |
currentState[0] = XSCMValidator.FIRST_ERROR; |
|
89 |
return null; |
|
90 |
} |
|
91 |
||
92 |
||
93 |
/** |
|
94 |
* The method indicates the end of list of children |
|
95 |
* |
|
96 |
* @param currentState Current state of the content model |
|
97 |
* @return true if the last state was a valid final state |
|
98 |
*/ |
|
99 |
public boolean endContentModel (int[] currentState){ |
|
100 |
boolean isFinal = false; |
|
101 |
int state = currentState[0]; |
|
102 |
||
103 |
// restore content model state: |
|
104 |
||
105 |
// error |
|
106 |
if (state < 0) { |
|
107 |
return false; |
|
108 |
} |
|
109 |
||
110 |
||
111 |
return true; |
|
112 |
} |
|
113 |
||
114 |
/** |
|
115 |
* check whether this content violates UPA constraint. |
|
116 |
* |
|
117 |
* @param subGroupHandler the substitution group handler |
|
118 |
* @return true if this content model contains other or list wildcard |
|
119 |
*/ |
|
120 |
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException { |
|
121 |
return false; |
|
122 |
} |
|
123 |
||
124 |
/** |
|
125 |
* Check which elements are valid to appear at this point. This method also |
|
126 |
* works if the state is in error, in which case it returns what should |
|
127 |
* have been seen. |
|
128 |
* |
|
129 |
* @param state the current state |
|
27111
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
130 |
* @return a list whose entries are instances of |
12005 | 131 |
* either XSWildcardDecl or XSElementDecl. |
132 |
*/ |
|
47359
e1a6c0168741
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents:
47216
diff
changeset
|
133 |
public List<Object> whatCanGoHere(int[] state) { |
12005 | 134 |
return EMPTY; |
135 |
} |
|
136 |
||
47359
e1a6c0168741
8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
joehw
parents:
47216
diff
changeset
|
137 |
public List<String> checkMinMaxBounds() { |
12005 | 138 |
return null; |
139 |
} |
|
140 |
||
27111
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
141 |
public int [] occurenceInfo(int[] state) { |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
142 |
return null; |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
143 |
} |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
144 |
|
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
145 |
public String getTermName(int termId) { |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
146 |
return null; |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
147 |
} |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
148 |
|
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
149 |
public boolean isCompactedForUPA() { |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
150 |
return false; |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
151 |
} |
12005 | 152 |
} // class XSEmptyCM |