1 /*
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Nov 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
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.impl.xs.traversers;
23
51 * appearing in the schema document. It
52 * - reports an error for invalid element (invalid namespace, invalid name)
53 * - reports an error for invalid attribute (invalid namespace, invalid name)
54 * - reports an error for invalid attribute value
55 * - return compiled values for attriute values
56 * - provide default value for missing optional attributes
57 * - provide default value for incorrect attribute values
58 *
59 * But it's the caller's responsibility to check whether a required attribute
60 * is present.
61 *
62 * Things need revisiting:
63 * - Whether to return non-schema attributes/values
64 * - Do we need to update NamespaceScope and ErrorReporter when reset()?
65 * - Should have the datatype validators return compiled value
66 * - use symbol table instead of many maps
67 *
68 * @xerces.internal
69 *
70 * @author Sandy Gao, IBM
71 */
72
73 public class XSAttributeChecker {
74
75 // REVISIT: only local element and attribute are different from others.
76 // it's possible to have either name or ref. all the others
77 // are only allowed to have one of name or ref, or neither of them.
78 // we'd better move such checking to the traverser.
79 private static final String ELEMENT_N = "element_n";
80 private static final String ELEMENT_R = "element_r";
81 private static final String ATTRIBUTE_N = "attribute_n";
82 private static final String ATTRIBUTE_R = "attribute_r";
83
84 private static int ATTIDX_COUNT = 0;
85 public static final int ATTIDX_ABSTRACT = ATTIDX_COUNT++;
86 public static final int ATTIDX_AFORMDEFAULT = ATTIDX_COUNT++;
87 public static final int ATTIDX_BASE = ATTIDX_COUNT++;
88 public static final int ATTIDX_BLOCK = ATTIDX_COUNT++;
89 public static final int ATTIDX_BLOCKDEFAULT = ATTIDX_COUNT++;
90 public static final int ATTIDX_DEFAULT = ATTIDX_COUNT++;
|
1 /*
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.impl.xs.traversers;
22
50 * appearing in the schema document. It
51 * - reports an error for invalid element (invalid namespace, invalid name)
52 * - reports an error for invalid attribute (invalid namespace, invalid name)
53 * - reports an error for invalid attribute value
54 * - return compiled values for attriute values
55 * - provide default value for missing optional attributes
56 * - provide default value for incorrect attribute values
57 *
58 * But it's the caller's responsibility to check whether a required attribute
59 * is present.
60 *
61 * Things need revisiting:
62 * - Whether to return non-schema attributes/values
63 * - Do we need to update NamespaceScope and ErrorReporter when reset()?
64 * - Should have the datatype validators return compiled value
65 * - use symbol table instead of many maps
66 *
67 * @xerces.internal
68 *
69 * @author Sandy Gao, IBM
70 * @LastModified: Nov 2017
71 */
72
73 public class XSAttributeChecker {
74
75 // REVISIT: only local element and attribute are different from others.
76 // it's possible to have either name or ref. all the others
77 // are only allowed to have one of name or ref, or neither of them.
78 // we'd better move such checking to the traverser.
79 private static final String ELEMENT_N = "element_n";
80 private static final String ELEMENT_R = "element_r";
81 private static final String ATTRIBUTE_N = "attribute_n";
82 private static final String ATTRIBUTE_R = "attribute_r";
83
84 private static int ATTIDX_COUNT = 0;
85 public static final int ATTIDX_ABSTRACT = ATTIDX_COUNT++;
86 public static final int ATTIDX_AFORMDEFAULT = ATTIDX_COUNT++;
87 public static final int ATTIDX_BASE = ATTIDX_COUNT++;
88 public static final int ATTIDX_BLOCK = ATTIDX_COUNT++;
89 public static final int ATTIDX_BLOCKDEFAULT = ATTIDX_COUNT++;
90 public static final int ATTIDX_DEFAULT = ATTIDX_COUNT++;
|