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: XMLContentModel.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
20 | */ |
---|
21 | |
---|
22 | |
---|
23 | #if !defined(CONTENTMODEL_HPP) |
---|
24 | #define CONTENTMODEL_HPP |
---|
25 | |
---|
26 | #include <xercesc/util/XMemory.hpp> |
---|
27 | #include <xercesc/util/QName.hpp> |
---|
28 | |
---|
29 | XERCES_CPP_NAMESPACE_BEGIN |
---|
30 | |
---|
31 | class ContentLeafNameTypeVector; |
---|
32 | class GrammarResolver; |
---|
33 | class XMLStringPool; |
---|
34 | class XMLValidator; |
---|
35 | class SchemaGrammar; |
---|
36 | |
---|
37 | /** |
---|
38 | * This class defines the abstract interface for all content models. All |
---|
39 | * elements have a content model against which (if validating) its content |
---|
40 | * is checked. Each type of validator (DTD, Schema, etc...) can have |
---|
41 | * different types of content models, and even with each type of validator |
---|
42 | * there can be specialized content models. So this simple class provides |
---|
43 | * the abstract API via which all the types of contents models are dealt |
---|
44 | * with generically. Its pretty simple. |
---|
45 | */ |
---|
46 | class XMLPARSER_EXPORT XMLContentModel : public XMemory |
---|
47 | { |
---|
48 | public: |
---|
49 | // --------------------------------------------------------------------------- |
---|
50 | // Public static data |
---|
51 | // |
---|
52 | // gInvalidTrans |
---|
53 | // This value represents an invalid transition in each line of the |
---|
54 | // transition table. |
---|
55 | // |
---|
56 | // gEOCFakeId |
---|
57 | // gEpsilonFakeId |
---|
58 | // We have to put in a couple of special CMLeaf nodes to represent |
---|
59 | // special values, using fake element ids that we know won't conflict |
---|
60 | // with real element ids. |
---|
61 | // |
---|
62 | // |
---|
63 | // --------------------------------------------------------------------------- |
---|
64 | static const unsigned int gInvalidTrans; |
---|
65 | static const unsigned int gEOCFakeId; |
---|
66 | static const unsigned int gEpsilonFakeId; |
---|
67 | |
---|
68 | // ----------------------------------------------------------------------- |
---|
69 | // Constructors are hidden, only the virtual Destructor is exposed |
---|
70 | // ----------------------------------------------------------------------- |
---|
71 | /** @name Destructor */ |
---|
72 | //@{ |
---|
73 | virtual ~XMLContentModel() |
---|
74 | { |
---|
75 | } |
---|
76 | //@} |
---|
77 | |
---|
78 | |
---|
79 | // ----------------------------------------------------------------------- |
---|
80 | // The virtual content model interface provided by derived classes |
---|
81 | // ----------------------------------------------------------------------- |
---|
82 | virtual int validateContent |
---|
83 | ( |
---|
84 | QName** const children |
---|
85 | , const unsigned int childCount |
---|
86 | , const unsigned int emptyNamespaceId |
---|
87 | ) const = 0; |
---|
88 | |
---|
89 | virtual int validateContentSpecial |
---|
90 | ( |
---|
91 | QName** const children |
---|
92 | , const unsigned int childCount |
---|
93 | , const unsigned int emptyNamespaceId |
---|
94 | , GrammarResolver* const pGrammarResolver |
---|
95 | , XMLStringPool* const pStringPool |
---|
96 | ) const =0; |
---|
97 | |
---|
98 | virtual void checkUniqueParticleAttribution |
---|
99 | ( |
---|
100 | SchemaGrammar* const pGrammar |
---|
101 | , GrammarResolver* const pGrammarResolver |
---|
102 | , XMLStringPool* const pStringPool |
---|
103 | , XMLValidator* const pValidator |
---|
104 | , unsigned int* const pContentSpecOrgURI |
---|
105 | , const XMLCh* pComplexTypeName = 0 |
---|
106 | ) =0; |
---|
107 | |
---|
108 | virtual ContentLeafNameTypeVector* getContentLeafNameTypeVector() |
---|
109 | const = 0; |
---|
110 | |
---|
111 | virtual unsigned int getNextState(const unsigned int currentState, |
---|
112 | const unsigned int elementIndex) const = 0; |
---|
113 | |
---|
114 | protected : |
---|
115 | // ----------------------------------------------------------------------- |
---|
116 | // Hidden Constructors |
---|
117 | // ----------------------------------------------------------------------- |
---|
118 | XMLContentModel() |
---|
119 | { |
---|
120 | } |
---|
121 | |
---|
122 | |
---|
123 | private : |
---|
124 | // ----------------------------------------------------------------------- |
---|
125 | // Unimplemented constructors and operators |
---|
126 | // ----------------------------------------------------------------------- |
---|
127 | XMLContentModel(const XMLContentModel&); |
---|
128 | XMLContentModel& operator=(const XMLContentModel&); |
---|
129 | }; |
---|
130 | |
---|
131 | XERCES_CPP_NAMESPACE_END |
---|
132 | |
---|
133 | #endif |
---|