1 | /* |
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
3 | * contributor license agreements. See the NOTICE file distributed with |
---|
4 | * this work for additional information regarding copyright ownership. |
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
6 | * (the "License"); you may not use this file except in compliance with |
---|
7 | * the License. You may obtain a copy of the License at |
---|
8 | * |
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | * |
---|
11 | * Unless required by applicable law or agreed to in writing, software |
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | * See the License for the specific language governing permissions and |
---|
15 | * limitations under the License. |
---|
16 | */ |
---|
17 | |
---|
18 | /* |
---|
19 | * $Id: XSWildcard.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
20 | */ |
---|
21 | |
---|
22 | #if !defined(XSWILDCARD_HPP) |
---|
23 | #define XSWILDCARD_HPP |
---|
24 | |
---|
25 | #include <xercesc/framework/psvi/XSObject.hpp> |
---|
26 | |
---|
27 | XERCES_CPP_NAMESPACE_BEGIN |
---|
28 | |
---|
29 | /** |
---|
30 | * This class describes all properties of a Schema Wildcard |
---|
31 | * component. |
---|
32 | * This is *always* owned by the validator /parser object from which |
---|
33 | * it is obtained. |
---|
34 | */ |
---|
35 | |
---|
36 | // forward declarations |
---|
37 | class XSAnnotation; |
---|
38 | class SchemaAttDef; |
---|
39 | class ContentSpecNode; |
---|
40 | |
---|
41 | class XMLPARSER_EXPORT XSWildcard : public XSObject |
---|
42 | { |
---|
43 | public: |
---|
44 | |
---|
45 | // Namespace Constraint |
---|
46 | enum NAMESPACE_CONSTRAINT { |
---|
47 | /** |
---|
48 | * Namespace Constraint: any namespace is allowed. |
---|
49 | */ |
---|
50 | NSCONSTRAINT_ANY = 1, |
---|
51 | /** |
---|
52 | * Namespace Constraint: namespaces in the list are not allowed. |
---|
53 | */ |
---|
54 | NSCONSTRAINT_NOT = 2, |
---|
55 | /** |
---|
56 | * Namespace Constraint: namespaces in the list are allowed. |
---|
57 | */ |
---|
58 | NSCONSTRAINT_DERIVATION_LIST = 3 |
---|
59 | }; |
---|
60 | |
---|
61 | // Process contents |
---|
62 | enum PROCESS_CONTENTS { |
---|
63 | /** |
---|
64 | * There must be a top-level declaration for the item available, or the |
---|
65 | * item must have an xsi:type, and the item must be valid as appropriate. |
---|
66 | */ |
---|
67 | PC_STRICT = 1, |
---|
68 | /** |
---|
69 | * No constraints at all: the item must simply be well-formed XML. |
---|
70 | */ |
---|
71 | PC_SKIP = 2, |
---|
72 | /** |
---|
73 | * If the item, or any items among its [children] is an element |
---|
74 | * information item, has a uniquely determined declaration available, it |
---|
75 | * must be valid with respect to that definition, that is, validate |
---|
76 | * where you can, don't worry when you can't. |
---|
77 | */ |
---|
78 | PC_LAX = 3 |
---|
79 | }; |
---|
80 | |
---|
81 | // Constructors and Destructor |
---|
82 | // ----------------------------------------------------------------------- |
---|
83 | /** @name Constructors */ |
---|
84 | //@{ |
---|
85 | |
---|
86 | /** |
---|
87 | * The default constructor |
---|
88 | * |
---|
89 | * @param attWildCard |
---|
90 | * @param annot |
---|
91 | * @param xsModel |
---|
92 | * @param manager The configurable memory manager |
---|
93 | */ |
---|
94 | XSWildcard |
---|
95 | ( |
---|
96 | SchemaAttDef* const attWildCard |
---|
97 | , XSAnnotation* const annot |
---|
98 | , XSModel* const xsModel |
---|
99 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
100 | ); |
---|
101 | |
---|
102 | XSWildcard |
---|
103 | ( |
---|
104 | const ContentSpecNode* const elmWildCard |
---|
105 | , XSAnnotation* const annot |
---|
106 | , XSModel* const xsModel |
---|
107 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
108 | ); |
---|
109 | |
---|
110 | //@} |
---|
111 | |
---|
112 | /** @name Destructor */ |
---|
113 | //@{ |
---|
114 | ~XSWildcard(); |
---|
115 | //@} |
---|
116 | |
---|
117 | //--------------------- |
---|
118 | /** @name XSWildcard methods */ |
---|
119 | |
---|
120 | //@{ |
---|
121 | |
---|
122 | /** |
---|
123 | * Namespace constraint: A constraint type: any, not, list. |
---|
124 | */ |
---|
125 | NAMESPACE_CONSTRAINT getConstraintType() const; |
---|
126 | |
---|
127 | /** |
---|
128 | * Namespace constraint. For <code>constraintType</code> |
---|
129 | * <code>NSCONSTRAINT_DERIVATION_LIST</code>, the list contains allowed namespaces. |
---|
130 | * For <code>constraintType</code> <code>NSCONSTRAINT_NOT</code>, the |
---|
131 | * list contains disallowed namespaces. |
---|
132 | */ |
---|
133 | StringList *getNsConstraintList(); |
---|
134 | |
---|
135 | /** |
---|
136 | * [process contents]: one of skip, lax or strict. Valid constants values |
---|
137 | * are: <code>PC_SKIP, PC_LAX, PC_STRICT</code>. |
---|
138 | */ |
---|
139 | PROCESS_CONTENTS getProcessContents() const; |
---|
140 | |
---|
141 | /** |
---|
142 | * Optional. An [annotation]. |
---|
143 | */ |
---|
144 | XSAnnotation *getAnnotation() const; |
---|
145 | |
---|
146 | //@} |
---|
147 | |
---|
148 | //---------------------------------- |
---|
149 | /** methods needed by implementation */ |
---|
150 | |
---|
151 | //@{ |
---|
152 | |
---|
153 | //@} |
---|
154 | private: |
---|
155 | |
---|
156 | // ----------------------------------------------------------------------- |
---|
157 | // Unimplemented constructors and operators |
---|
158 | // ----------------------------------------------------------------------- |
---|
159 | XSWildcard(const XSWildcard&); |
---|
160 | XSWildcard & operator=(const XSWildcard &); |
---|
161 | |
---|
162 | /** |
---|
163 | * Build namespace list |
---|
164 | */ |
---|
165 | void buildNamespaceList(const ContentSpecNode* const rootNode); |
---|
166 | |
---|
167 | protected: |
---|
168 | |
---|
169 | // ----------------------------------------------------------------------- |
---|
170 | // data members |
---|
171 | // ----------------------------------------------------------------------- |
---|
172 | NAMESPACE_CONSTRAINT fConstraintType; |
---|
173 | PROCESS_CONTENTS fProcessContents; |
---|
174 | StringList* fNsConstraintList; |
---|
175 | XSAnnotation* fAnnotation; |
---|
176 | }; |
---|
177 | |
---|
178 | inline XSAnnotation *XSWildcard::getAnnotation() const |
---|
179 | { |
---|
180 | return fAnnotation; |
---|
181 | } |
---|
182 | |
---|
183 | inline XSWildcard::PROCESS_CONTENTS XSWildcard::getProcessContents() const |
---|
184 | { |
---|
185 | return fProcessContents; |
---|
186 | } |
---|
187 | |
---|
188 | inline StringList* XSWildcard::getNsConstraintList() |
---|
189 | { |
---|
190 | return fNsConstraintList; |
---|
191 | } |
---|
192 | |
---|
193 | inline XSWildcard::NAMESPACE_CONSTRAINT XSWildcard::getConstraintType() const |
---|
194 | { |
---|
195 | return fConstraintType; |
---|
196 | } |
---|
197 | |
---|
198 | |
---|
199 | XERCES_CPP_NAMESPACE_END |
---|
200 | |
---|
201 | #endif |
---|