source: NonGTP/Xerces/xerces/include/xercesc/framework/XMLContentModel.hpp @ 358

Revision 358, 6.7 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-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: XMLContentModel.hpp,v $
19 * Revision 1.6  2004/09/16 13:32:05  amassari
20 * Updated error message for UPA to also state the complex type that is failing the test
21 *
22 * Revision 1.5  2004/09/08 13:55:58  peiyongz
23 * Apache License Version 2.0
24 *
25 * Revision 1.4  2003/05/15 18:26:07  knoaman
26 * Partial implementation of the configurable memory manager.
27 *
28 * Revision 1.3  2003/03/07 18:08:10  tng
29 * Return a reference instead of void for operator=
30 *
31 * Revision 1.2  2002/11/04 15:00:21  tng
32 * C++ Namespace Support.
33 *
34 * Revision 1.1.1.1  2002/02/01 22:21:51  peiyongz
35 * sane_include
36 *
37 * Revision 1.14  2001/11/21 14:30:13  knoaman
38 * Fix for UPA checking.
39 *
40 * Revision 1.13  2001/08/21 16:06:10  tng
41 * Schema: Unique Particle Attribution Constraint Checking.
42 *
43 * Revision 1.12  2001/08/13 15:06:38  knoaman
44 * update <any> validation.
45 *
46 * Revision 1.11  2001/05/28 20:53:35  tng
47 * Schema: move static data gInvalidTrans, gEOCFakeId, gEpsilonFakeId to XMLContentModel for others to access
48 *
49 * Revision 1.10  2001/05/11 13:25:31  tng
50 * Copyright update.
51 *
52 * Revision 1.9  2001/05/03 21:02:23  tng
53 * Schema: Add SubstitutionGroupComparator and update exception messages.  By Pei Yong Zhang.
54 *
55 * Revision 1.8  2001/04/19 18:16:50  tng
56 * Schema: SchemaValidator update, and use QName in Content Model
57 *
58 * Revision 1.7  2001/03/21 21:56:01  tng
59 * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
60 *
61 * Revision 1.6  2001/02/27 14:48:30  tng
62 * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
63 *
64 * Revision 1.5  2000/03/02 19:54:24  roddey
65 * This checkin includes many changes done while waiting for the
66 * 1.1.0 code to be finished. I can't list them all here, but a list is
67 * available elsewhere.
68 *
69 * Revision 1.4  2000/02/24 20:00:23  abagchi
70 * Swat for removing Log from API docs
71 *
72 * Revision 1.3  2000/02/15 01:21:30  roddey
73 * Some initial documentation improvements. More to come...
74 *
75 * Revision 1.2  2000/02/06 07:47:48  rahulj
76 * Year 2K copyright swat.
77 *
78 * Revision 1.1.1.1  1999/11/09 01:08:30  twl
79 * Initial checkin
80 *
81 * Revision 1.2  1999/11/08 20:44:37  rahul
82 * Swat for adding in Product name and CVS comment log variable.
83 *
84 */
85
86
87#if !defined(CONTENTMODEL_HPP)
88#define CONTENTMODEL_HPP
89
90#include <xercesc/util/XMemory.hpp>
91#include <xercesc/util/QName.hpp>
92
93XERCES_CPP_NAMESPACE_BEGIN
94
95class ContentLeafNameTypeVector;
96class GrammarResolver;
97class XMLStringPool;
98class XMLValidator;
99class SchemaGrammar;
100
101/**
102 *  This class defines the abstract interface for all content models. All
103 *  elements have a content model against which (if validating) its content
104 *  is checked. Each type of validator (DTD, Schema, etc...) can have
105 *  different types of content models, and even with each type of validator
106 *  there can be specialized content models. So this simple class provides
107 *  the abstract API via which all the types of contents models are dealt
108 *  with generically. Its pretty simple.
109 */
110class XMLPARSER_EXPORT XMLContentModel : public XMemory
111{
112public:
113    // ---------------------------------------------------------------------------
114    //  Public static data
115    //
116    //  gInvalidTrans
117    //      This value represents an invalid transition in each line of the
118    //      transition table.
119    //
120    //  gEOCFakeId
121    //  gEpsilonFakeId
122    //      We have to put in a couple of special CMLeaf nodes to represent
123    //      special values, using fake element ids that we know won't conflict
124    //      with real element ids.
125    //
126    //
127    // ---------------------------------------------------------------------------
128    static const unsigned int   gInvalidTrans;
129    static const unsigned int   gEOCFakeId;
130    static const unsigned int   gEpsilonFakeId;
131
132    // -----------------------------------------------------------------------
133    //  Constructors are hidden, only the virtual Destructor is exposed
134    // -----------------------------------------------------------------------
135    /** @name Destructor */
136    //@{
137    virtual ~XMLContentModel()
138    {
139    }
140    //@}
141
142
143    // -----------------------------------------------------------------------
144    //  The virtual content model interface provided by derived classes
145    // -----------------------------------------------------------------------
146        virtual int validateContent
147    (
148        QName** const         children
149      , const unsigned int    childCount
150      , const unsigned int    emptyNamespaceId
151    ) const = 0;
152
153        virtual int validateContentSpecial
154    (
155        QName** const           children
156      , const unsigned int      childCount
157      , const unsigned int      emptyNamespaceId
158      , GrammarResolver*  const pGrammarResolver
159      , XMLStringPool*    const pStringPool
160    ) const =0;
161
162        virtual void checkUniqueParticleAttribution
163    (
164        SchemaGrammar*    const pGrammar
165      , GrammarResolver*  const pGrammarResolver
166      , XMLStringPool*    const pStringPool
167      , XMLValidator*     const pValidator
168      , unsigned int*     const pContentSpecOrgURI
169      , const XMLCh*            pComplexTypeName = 0
170    ) =0;
171
172    virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector()
173          const = 0;
174
175    virtual unsigned int getNextState(const unsigned int currentState,
176                                      const unsigned int elementIndex) const = 0;
177
178protected :
179    // -----------------------------------------------------------------------
180    //  Hidden Constructors
181    // -----------------------------------------------------------------------
182    XMLContentModel()
183    {
184    }
185
186
187private :
188    // -----------------------------------------------------------------------
189    //  Unimplemented constructors and operators
190    // -----------------------------------------------------------------------
191    XMLContentModel(const XMLContentModel&);
192    XMLContentModel& operator=(const XMLContentModel&);
193};
194
195XERCES_CPP_NAMESPACE_END
196
197#endif
Note: See TracBrowser for help on using the repository browser.