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