author | joehw |
Mon, 13 Oct 2014 14:09:03 -0700 | |
changeset 27111 | 7a491d709b83 |
parent 25868 | 686eef1e7a79 |
child 45853 | bfa06be36a17 |
permissions | -rw-r--r-- |
12005 | 1 |
/* |
2 |
* reserved comment block |
|
3 |
* DO NOT REMOVE OR ALTER! |
|
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 |
||
22 |
package com.sun.org.apache.xerces.internal.impl.xs; |
|
23 |
||
24 |
import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo; |
|
25 |
import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl; |
|
26 |
import com.sun.org.apache.xerces.internal.xs.ShortList; |
|
27 |
import com.sun.org.apache.xerces.internal.xs.XSAttributeDeclaration; |
|
28 |
import com.sun.org.apache.xerces.internal.xs.XSAttributeUse; |
|
29 |
import com.sun.org.apache.xerces.internal.xs.XSConstants; |
|
30 |
import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem; |
|
31 |
import com.sun.org.apache.xerces.internal.xs.XSObjectList; |
|
27111
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
32 |
import com.sun.org.apache.xerces.internal.xs.XSValue; |
12005 | 33 |
|
34 |
/** |
|
35 |
* The XML representation for an attribute use |
|
36 |
* schema component is a local <attribute> element information item |
|
37 |
* |
|
38 |
* @xerces.internal |
|
39 |
* |
|
40 |
* @author Sandy Gao, IBM |
|
41 |
*/ |
|
42 |
public class XSAttributeUseImpl implements XSAttributeUse { |
|
43 |
||
44 |
// the referred attribute decl |
|
45 |
public XSAttributeDecl fAttrDecl = null; |
|
46 |
// use information: SchemaSymbols.USE_OPTIONAL, REQUIRED, PROHIBITED |
|
47 |
public short fUse = SchemaSymbols.USE_OPTIONAL; |
|
48 |
// value constraint type: default, fixed or !specified |
|
49 |
public short fConstraintType = XSConstants.VC_NONE; |
|
50 |
// value constraint value |
|
51 |
public ValidatedInfo fDefault = null; |
|
52 |
// optional annotation |
|
53 |
public XSObjectList fAnnotations = null; |
|
54 |
||
55 |
public void reset(){ |
|
56 |
fDefault = null; |
|
57 |
fAttrDecl = null; |
|
58 |
fUse = SchemaSymbols.USE_OPTIONAL; |
|
59 |
fConstraintType = XSConstants.VC_NONE; |
|
60 |
fAnnotations = null; |
|
61 |
} |
|
62 |
||
63 |
/** |
|
64 |
* Get the type of the object, i.e ELEMENT_DECLARATION. |
|
65 |
*/ |
|
66 |
public short getType() { |
|
67 |
return XSConstants.ATTRIBUTE_USE; |
|
68 |
} |
|
69 |
||
70 |
/** |
|
71 |
* The <code>name</code> of this <code>XSObject</code> depending on the |
|
72 |
* <code>XSObject</code> type. |
|
73 |
*/ |
|
74 |
public String getName() { |
|
75 |
return null; |
|
76 |
} |
|
77 |
||
78 |
/** |
|
79 |
* The namespace URI of this node, or <code>null</code> if it is |
|
80 |
* unspecified. defines how a namespace URI is attached to schema |
|
81 |
* components. |
|
82 |
*/ |
|
83 |
public String getNamespace() { |
|
84 |
return null; |
|
85 |
} |
|
86 |
||
87 |
/** |
|
88 |
* {required} determines whether this use of an attribute declaration |
|
89 |
* requires an appropriate attribute information item to be present, or |
|
90 |
* merely allows it. |
|
91 |
*/ |
|
92 |
public boolean getRequired() { |
|
93 |
return fUse == SchemaSymbols.USE_REQUIRED; |
|
94 |
} |
|
95 |
||
96 |
/** |
|
97 |
* {attribute declaration} provides the attribute declaration itself, |
|
98 |
* which will in turn determine the simple type definition used. |
|
99 |
*/ |
|
100 |
public XSAttributeDeclaration getAttrDeclaration() { |
|
101 |
return fAttrDecl; |
|
102 |
} |
|
103 |
||
104 |
/** |
|
105 |
* Value Constraint: one of default, fixed. |
|
106 |
*/ |
|
107 |
public short getConstraintType() { |
|
108 |
return fConstraintType; |
|
109 |
} |
|
110 |
||
111 |
/** |
|
112 |
* Value Constraint: The actual value (with respect to the {type |
|
113 |
* definition}). |
|
114 |
*/ |
|
115 |
public String getConstraintValue() { |
|
116 |
// REVISIT: SCAPI: what's the proper representation |
|
117 |
return getConstraintType() == XSConstants.VC_NONE ? |
|
118 |
null : |
|
119 |
fDefault.stringValue(); |
|
120 |
} |
|
121 |
||
122 |
/** |
|
123 |
* @see org.apache.xerces.xs.XSObject#getNamespaceItem() |
|
124 |
*/ |
|
125 |
public XSNamespaceItem getNamespaceItem() { |
|
126 |
return null; |
|
127 |
} |
|
128 |
||
129 |
public Object getActualVC() { |
|
130 |
return getConstraintType() == XSConstants.VC_NONE ? |
|
131 |
null : |
|
132 |
fDefault.actualValue; |
|
133 |
} |
|
134 |
||
135 |
public short getActualVCType() { |
|
136 |
return getConstraintType() == XSConstants.VC_NONE ? |
|
137 |
XSConstants.UNAVAILABLE_DT : |
|
138 |
fDefault.actualValueType; |
|
139 |
} |
|
140 |
||
141 |
public ShortList getItemValueTypes() { |
|
142 |
return getConstraintType() == XSConstants.VC_NONE ? |
|
143 |
null : |
|
144 |
fDefault.itemValueTypes; |
|
145 |
} |
|
146 |
||
27111
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
147 |
public XSValue getValueConstraintValue() { |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
148 |
return fDefault; |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
149 |
} |
7a491d709b83
8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
joehw
parents:
25868
diff
changeset
|
150 |
|
12005 | 151 |
/** |
152 |
* Optional. Annotations. |
|
153 |
*/ |
|
154 |
public XSObjectList getAnnotations() { |
|
155 |
return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST; |
|
156 |
} |
|
157 |
||
158 |
} // class XSAttributeUseImpl |