1 | /*
|
---|
2 | * The Apache Software License, Version 1.1
|
---|
3 | *
|
---|
4 | * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
|
---|
5 | * reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | *
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | *
|
---|
14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
15 | * notice, this list of conditions and the following disclaimer in
|
---|
16 | * the documentation and/or other materials provided with the
|
---|
17 | * distribution.
|
---|
18 | *
|
---|
19 | * 3. The end-user documentation included with the redistribution,
|
---|
20 | * if any, must include the following acknowledgment:
|
---|
21 | * "This product includes software developed by the
|
---|
22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
25 | *
|
---|
26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
27 | * not be used to endorse or promote products derived from this
|
---|
28 | * software without prior written permission. For written
|
---|
29 | * permission, please contact apache\@apache.org.
|
---|
30 | *
|
---|
31 | * 5. Products derived from this software may not be called "Apache",
|
---|
32 | * nor may "Apache" appear in their name, without prior written
|
---|
33 | * permission of the Apache Software Foundation.
|
---|
34 | *
|
---|
35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
46 | * SUCH DAMAGE.
|
---|
47 | * ====================================================================
|
---|
48 | *
|
---|
49 | * This software consists of voluntary contributions made by many
|
---|
50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
51 | * originally based on software copyright (c) 1999, International
|
---|
52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
53 | * on the Apache Software Foundation, please see
|
---|
54 | * <http://www.apache.org/>.
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * $Log: XMLContentModel.hpp,v $
|
---|
59 | * Revision 1.4 2003/05/15 18:26:07 knoaman
|
---|
60 | * Partial implementation of the configurable memory manager.
|
---|
61 | *
|
---|
62 | * Revision 1.3 2003/03/07 18:08:10 tng
|
---|
63 | * Return a reference instead of void for operator=
|
---|
64 | *
|
---|
65 | * Revision 1.2 2002/11/04 15:00:21 tng
|
---|
66 | * C++ Namespace Support.
|
---|
67 | *
|
---|
68 | * Revision 1.1.1.1 2002/02/01 22:21:51 peiyongz
|
---|
69 | * sane_include
|
---|
70 | *
|
---|
71 | * Revision 1.14 2001/11/21 14:30:13 knoaman
|
---|
72 | * Fix for UPA checking.
|
---|
73 | *
|
---|
74 | * Revision 1.13 2001/08/21 16:06:10 tng
|
---|
75 | * Schema: Unique Particle Attribution Constraint Checking.
|
---|
76 | *
|
---|
77 | * Revision 1.12 2001/08/13 15:06:38 knoaman
|
---|
78 | * update <any> validation.
|
---|
79 | *
|
---|
80 | * Revision 1.11 2001/05/28 20:53:35 tng
|
---|
81 | * Schema: move static data gInvalidTrans, gEOCFakeId, gEpsilonFakeId to XMLContentModel for others to access
|
---|
82 | *
|
---|
83 | * Revision 1.10 2001/05/11 13:25:31 tng
|
---|
84 | * Copyright update.
|
---|
85 | *
|
---|
86 | * Revision 1.9 2001/05/03 21:02:23 tng
|
---|
87 | * Schema: Add SubstitutionGroupComparator and update exception messages. By Pei Yong Zhang.
|
---|
88 | *
|
---|
89 | * Revision 1.8 2001/04/19 18:16:50 tng
|
---|
90 | * Schema: SchemaValidator update, and use QName in Content Model
|
---|
91 | *
|
---|
92 | * Revision 1.7 2001/03/21 21:56:01 tng
|
---|
93 | * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
|
---|
94 | *
|
---|
95 | * Revision 1.6 2001/02/27 14:48:30 tng
|
---|
96 | * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
|
---|
97 | *
|
---|
98 | * Revision 1.5 2000/03/02 19:54:24 roddey
|
---|
99 | * This checkin includes many changes done while waiting for the
|
---|
100 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
101 | * available elsewhere.
|
---|
102 | *
|
---|
103 | * Revision 1.4 2000/02/24 20:00:23 abagchi
|
---|
104 | * Swat for removing Log from API docs
|
---|
105 | *
|
---|
106 | * Revision 1.3 2000/02/15 01:21:30 roddey
|
---|
107 | * Some initial documentation improvements. More to come...
|
---|
108 | *
|
---|
109 | * Revision 1.2 2000/02/06 07:47:48 rahulj
|
---|
110 | * Year 2K copyright swat.
|
---|
111 | *
|
---|
112 | * Revision 1.1.1.1 1999/11/09 01:08:30 twl
|
---|
113 | * Initial checkin
|
---|
114 | *
|
---|
115 | * Revision 1.2 1999/11/08 20:44:37 rahul
|
---|
116 | * Swat for adding in Product name and CVS comment log variable.
|
---|
117 | *
|
---|
118 | */
|
---|
119 |
|
---|
120 |
|
---|
121 | #if !defined(CONTENTMODEL_HPP)
|
---|
122 | #define CONTENTMODEL_HPP
|
---|
123 |
|
---|
124 | #include <xercesc/util/XMemory.hpp>
|
---|
125 | #include <xercesc/util/QName.hpp>
|
---|
126 |
|
---|
127 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
128 |
|
---|
129 | class ContentLeafNameTypeVector;
|
---|
130 | class GrammarResolver;
|
---|
131 | class XMLStringPool;
|
---|
132 | class XMLValidator;
|
---|
133 | class SchemaGrammar;
|
---|
134 |
|
---|
135 | /**
|
---|
136 | * This class defines the abstract interface for all content models. All
|
---|
137 | * elements have a content model against which (if validating) its content
|
---|
138 | * is checked. Each type of validator (DTD, Schema, etc...) can have
|
---|
139 | * different types of content models, and even with each type of validator
|
---|
140 | * there can be specialized content models. So this simple class provides
|
---|
141 | * the abstract API via which all the types of contents models are dealt
|
---|
142 | * with generically. Its pretty simple.
|
---|
143 | */
|
---|
144 | class XMLPARSER_EXPORT XMLContentModel : public XMemory
|
---|
145 | {
|
---|
146 | public:
|
---|
147 | // ---------------------------------------------------------------------------
|
---|
148 | // Public static data
|
---|
149 | //
|
---|
150 | // gInvalidTrans
|
---|
151 | // This value represents an invalid transition in each line of the
|
---|
152 | // transition table.
|
---|
153 | //
|
---|
154 | // gEOCFakeId
|
---|
155 | // gEpsilonFakeId
|
---|
156 | // We have to put in a couple of special CMLeaf nodes to represent
|
---|
157 | // special values, using fake element ids that we know won't conflict
|
---|
158 | // with real element ids.
|
---|
159 | //
|
---|
160 | //
|
---|
161 | // ---------------------------------------------------------------------------
|
---|
162 | static const unsigned int gInvalidTrans;
|
---|
163 | static const unsigned int gEOCFakeId;
|
---|
164 | static const unsigned int gEpsilonFakeId;
|
---|
165 |
|
---|
166 | // -----------------------------------------------------------------------
|
---|
167 | // Constructors are hidden, only the virtual Destructor is exposed
|
---|
168 | // -----------------------------------------------------------------------
|
---|
169 | /** @name Destructor */
|
---|
170 | //@{
|
---|
171 | virtual ~XMLContentModel()
|
---|
172 | {
|
---|
173 | }
|
---|
174 | //@}
|
---|
175 |
|
---|
176 |
|
---|
177 | // -----------------------------------------------------------------------
|
---|
178 | // The virtual content model interface provided by derived classes
|
---|
179 | // -----------------------------------------------------------------------
|
---|
180 | virtual int validateContent
|
---|
181 | (
|
---|
182 | QName** const children
|
---|
183 | , const unsigned int childCount
|
---|
184 | , const unsigned int emptyNamespaceId
|
---|
185 | ) const = 0;
|
---|
186 |
|
---|
187 | virtual int validateContentSpecial
|
---|
188 | (
|
---|
189 | QName** const children
|
---|
190 | , const unsigned int childCount
|
---|
191 | , const unsigned int emptyNamespaceId
|
---|
192 | , GrammarResolver* const pGrammarResolver
|
---|
193 | , XMLStringPool* const pStringPool
|
---|
194 | ) const =0;
|
---|
195 |
|
---|
196 | virtual void checkUniqueParticleAttribution
|
---|
197 | (
|
---|
198 | SchemaGrammar* const pGrammar
|
---|
199 | , GrammarResolver* const pGrammarResolver
|
---|
200 | , XMLStringPool* const pStringPool
|
---|
201 | , XMLValidator* const pValidator
|
---|
202 | , unsigned int* const pContentSpecOrgURI
|
---|
203 | ) =0;
|
---|
204 |
|
---|
205 | virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector()
|
---|
206 | const = 0;
|
---|
207 |
|
---|
208 | virtual unsigned int getNextState(const unsigned int currentState,
|
---|
209 | const unsigned int elementIndex) const = 0;
|
---|
210 |
|
---|
211 | protected :
|
---|
212 | // -----------------------------------------------------------------------
|
---|
213 | // Hidden Constructors
|
---|
214 | // -----------------------------------------------------------------------
|
---|
215 | XMLContentModel()
|
---|
216 | {
|
---|
217 | }
|
---|
218 |
|
---|
219 |
|
---|
220 | private :
|
---|
221 | // -----------------------------------------------------------------------
|
---|
222 | // Unimplemented constructors and operators
|
---|
223 | // -----------------------------------------------------------------------
|
---|
224 | XMLContentModel(const XMLContentModel&);
|
---|
225 | XMLContentModel& operator=(const XMLContentModel&);
|
---|
226 | };
|
---|
227 |
|
---|
228 | XERCES_CPP_NAMESPACE_END
|
---|
229 |
|
---|
230 | #endif
|
---|