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: PSVIElement.hpp,v $
|
---|
19 | * Revision 1.7 2004/09/08 13:56:07 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.6 2003/11/28 21:18:31 knoaman
|
---|
23 | * Make use of canonical representation in PSVIElement
|
---|
24 | *
|
---|
25 | * Revision 1.5 2003/11/27 22:52:37 knoaman
|
---|
26 | * PSVIElement implementation
|
---|
27 | *
|
---|
28 | * Revision 1.4 2003/11/21 22:34:45 neilg
|
---|
29 | * More schema component model implementation, thanks to David Cargill.
|
---|
30 | * In particular, this cleans up and completes the XSModel, XSNamespaceItem,
|
---|
31 | * XSAttributeDeclaration and XSAttributeGroup implementations.
|
---|
32 | *
|
---|
33 | * Revision 1.3 2003/11/06 21:50:33 neilg
|
---|
34 | * fix compilation errors under gcc 3.3.
|
---|
35 | *
|
---|
36 | * Revision 1.2 2003/11/06 15:30:04 neilg
|
---|
37 | * 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.
|
---|
38 | *
|
---|
39 | * Revision 1.1 2003/09/16 14:33:36 neilg
|
---|
40 | * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
|
---|
41 | *
|
---|
42 | */
|
---|
43 |
|
---|
44 | #if !defined(PSVIELEMENT_HPP)
|
---|
45 | #define PSVIELEMENT_HPP
|
---|
46 |
|
---|
47 | #include <xercesc/framework/psvi/PSVIItem.hpp>
|
---|
48 |
|
---|
49 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Represent the PSVI contributions for one element information item.
|
---|
53 | * This is *always* owned by the scanner/parser object from which
|
---|
54 | * it is obtained. The validator will specify
|
---|
55 | * under what conditions it may be relied upon to have meaningful contents.
|
---|
56 | */
|
---|
57 |
|
---|
58 | // forward declarations
|
---|
59 | class XSElementDeclaration;
|
---|
60 | class XSNotationDeclaration;
|
---|
61 | class XSModel;
|
---|
62 |
|
---|
63 | class XMLPARSER_EXPORT PSVIElement : public PSVIItem
|
---|
64 | {
|
---|
65 | public:
|
---|
66 |
|
---|
67 | // Constructors and Destructor
|
---|
68 | // -----------------------------------------------------------------------
|
---|
69 | /** @name Constructors */
|
---|
70 | //@{
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * The default constructor
|
---|
74 | *
|
---|
75 | * @param manager The configurable memory manager
|
---|
76 | */
|
---|
77 | PSVIElement( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
78 |
|
---|
79 | //@};
|
---|
80 |
|
---|
81 | /** @name Destructor */
|
---|
82 | //@{
|
---|
83 | ~PSVIElement();
|
---|
84 | //@}
|
---|
85 |
|
---|
86 | //---------------------
|
---|
87 | /** @name PSVIElement methods */
|
---|
88 |
|
---|
89 | //@{
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * An item isomorphic to the element declaration used to validate
|
---|
93 | * this element.
|
---|
94 | *
|
---|
95 | * @return an element declaration
|
---|
96 | */
|
---|
97 | XSElementDeclaration *getElementDeclaration();
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * [notation]
|
---|
101 | * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-notation">XML Schema Part 1: Structures [notation]</a>
|
---|
102 | * @return The notation declaration.
|
---|
103 | */
|
---|
104 | XSNotationDeclaration *getNotationDeclaration();
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * [schema information]
|
---|
108 | * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_information">XML Schema Part 1: Structures [schema information]</a>
|
---|
109 | * @return The schema information property if it's the validation root,
|
---|
110 | * null otherwise.
|
---|
111 | */
|
---|
112 | XSModel *getSchemaInformation();
|
---|
113 |
|
---|
114 | /**
|
---|
115 | * An item isomorphic to the type definition used to validate this element.
|
---|
116 | *
|
---|
117 | * @return a type declaration
|
---|
118 | */
|
---|
119 | XSTypeDefinition *getTypeDefinition();
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * If and only if that type definition is a simple type definition
|
---|
123 | * with {variety} union, or a complex type definition whose {content type}
|
---|
124 | * is a simple type definition with {variety} union, then an item isomorphic
|
---|
125 | * to that member of the union's {member type definitions} which actually
|
---|
126 | * validated the element item's normalized value.
|
---|
127 | *
|
---|
128 | * @return a simple type declaration
|
---|
129 | */
|
---|
130 | XSSimpleTypeDefinition *getMemberTypeDefinition();
|
---|
131 |
|
---|
132 | //@}
|
---|
133 |
|
---|
134 | //----------------------------------
|
---|
135 | /** methods needed by implementation */
|
---|
136 |
|
---|
137 | //@{
|
---|
138 | void reset
|
---|
139 | (
|
---|
140 | const VALIDITY_STATE validityState
|
---|
141 | , const ASSESSMENT_TYPE assessmentType
|
---|
142 | , const XMLCh* const validationContext
|
---|
143 | , bool isSpecified
|
---|
144 | , XSElementDeclaration* const elemDecl
|
---|
145 | , XSTypeDefinition* const typeDef
|
---|
146 | , XSSimpleTypeDefinition* const memberType
|
---|
147 | , XSModel* const schemaInfo
|
---|
148 | , const XMLCh* const defaultValue
|
---|
149 | , const XMLCh* const normalizedValue = 0
|
---|
150 | , XMLCh* const canonicalValue = 0
|
---|
151 | , XSNotationDeclaration* const notationDecl = 0
|
---|
152 | );
|
---|
153 |
|
---|
154 | //@}
|
---|
155 |
|
---|
156 | private:
|
---|
157 |
|
---|
158 | // -----------------------------------------------------------------------
|
---|
159 | // Unimplemented constructors and operators
|
---|
160 | // -----------------------------------------------------------------------
|
---|
161 | PSVIElement(const PSVIElement&);
|
---|
162 | PSVIElement & operator=(const PSVIElement &);
|
---|
163 |
|
---|
164 |
|
---|
165 | // -----------------------------------------------------------------------
|
---|
166 | // data members
|
---|
167 | // -----------------------------------------------------------------------
|
---|
168 | // fElementDecl
|
---|
169 | // element declaration component that validated this element
|
---|
170 | // fNotationDecl
|
---|
171 | // (optional) notation decl associated with this element
|
---|
172 | // fSchemaInfo
|
---|
173 | // Schema Information Item with which this validation episode is associated
|
---|
174 | XSElementDeclaration *fElementDecl;
|
---|
175 | XSNotationDeclaration *fNotationDecl;
|
---|
176 | XSModel *fSchemaInfo;
|
---|
177 | };
|
---|
178 |
|
---|
179 | inline XSElementDeclaration *PSVIElement::getElementDeclaration()
|
---|
180 | {
|
---|
181 | return fElementDecl;
|
---|
182 | }
|
---|
183 |
|
---|
184 | inline XSNotationDeclaration* PSVIElement::getNotationDeclaration()
|
---|
185 | {
|
---|
186 | return fNotationDecl;
|
---|
187 | }
|
---|
188 |
|
---|
189 | inline XSModel* PSVIElement::getSchemaInformation()
|
---|
190 | {
|
---|
191 | return fSchemaInfo;
|
---|
192 | }
|
---|
193 |
|
---|
194 | XERCES_CPP_NAMESPACE_END
|
---|
195 |
|
---|
196 | #endif
|
---|