[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 2001 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) 2001, 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 | * $Id: ComplexTypeInfo.hpp,v 1.19 2003/12/24 17:42:03 knoaman Exp $
|
---|
| 59 | */
|
---|
| 60 |
|
---|
| 61 | #if !defined(COMPLEXTYPEINFO_HPP)
|
---|
| 62 | #define COMPLEXTYPEINFO_HPP
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | /**
|
---|
| 66 | * The class act as a place holder to store complex type information.
|
---|
| 67 | *
|
---|
| 68 | * The class is intended for internal use.
|
---|
| 69 | */
|
---|
| 70 |
|
---|
| 71 | // ---------------------------------------------------------------------------
|
---|
| 72 | // Includes
|
---|
| 73 | // ---------------------------------------------------------------------------
|
---|
| 74 | #include <xercesc/util/XMLString.hpp>
|
---|
| 75 | #include <xercesc/util/RefHash2KeysTableOf.hpp>
|
---|
| 76 | #include <xercesc/util/RefVectorOf.hpp>
|
---|
| 77 | #include <xercesc/framework/XMLElementDecl.hpp>
|
---|
| 78 | #include <xercesc/framework/XMLContentModel.hpp>
|
---|
| 79 | #include <xercesc/validators/schema/SchemaAttDef.hpp>
|
---|
| 80 | #include <xercesc/internal/XSerializable.hpp>
|
---|
| 81 |
|
---|
| 82 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 | // ---------------------------------------------------------------------------
|
---|
| 86 | // Forward Declarations
|
---|
| 87 | // ---------------------------------------------------------------------------
|
---|
| 88 | class DatatypeValidator;
|
---|
| 89 | class ContentSpecNode;
|
---|
| 90 | class SchemaAttDefList;
|
---|
| 91 | class SchemaElementDecl;
|
---|
| 92 | class XSDLocator;
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | class VALIDATORS_EXPORT ComplexTypeInfo : public XSerializable, public XMemory
|
---|
| 96 | {
|
---|
| 97 | public:
|
---|
| 98 | // -----------------------------------------------------------------------
|
---|
| 99 | // Public Constructors/Destructor
|
---|
| 100 | // -----------------------------------------------------------------------
|
---|
| 101 | ComplexTypeInfo(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
| 102 | ~ComplexTypeInfo();
|
---|
| 103 |
|
---|
| 104 | // -----------------------------------------------------------------------
|
---|
| 105 | // Getter methods
|
---|
| 106 | // -----------------------------------------------------------------------
|
---|
| 107 | bool getAbstract() const;
|
---|
| 108 | bool getAdoptContentSpec() const;
|
---|
| 109 | bool containsAttWithTypeId() const;
|
---|
| 110 | bool getPreprocessed() const;
|
---|
| 111 | int getDerivedBy() const;
|
---|
| 112 | int getBlockSet() const;
|
---|
| 113 | int getFinalSet() const;
|
---|
| 114 | int getScopeDefined() const;
|
---|
| 115 | unsigned int getElementId() const;
|
---|
| 116 | int getContentType() const;
|
---|
| 117 | unsigned int elementCount() const;
|
---|
| 118 | XMLCh* getTypeName() const;
|
---|
| 119 | DatatypeValidator* getBaseDatatypeValidator() const;
|
---|
| 120 | DatatypeValidator* getDatatypeValidator() const;
|
---|
| 121 | ComplexTypeInfo* getBaseComplexTypeInfo() const;
|
---|
| 122 | ContentSpecNode* getContentSpec() const;
|
---|
| 123 | const SchemaAttDef* getAttWildCard() const;
|
---|
| 124 | SchemaAttDef* getAttWildCard();
|
---|
| 125 | const SchemaAttDef* getAttDef(const XMLCh* const baseName,
|
---|
| 126 | const int uriId) const;
|
---|
| 127 | SchemaAttDef* getAttDef(const XMLCh* const baseName,
|
---|
| 128 | const int uriId);
|
---|
| 129 | XMLAttDefList& getAttDefList() const;
|
---|
| 130 | const SchemaElementDecl* elementAt(const unsigned int index) const;
|
---|
| 131 | SchemaElementDecl* elementAt(const unsigned int index);
|
---|
| 132 | XMLContentModel* getContentModel(const bool checkUPA = false);
|
---|
| 133 | const XMLCh* getFormattedContentModel () const;
|
---|
| 134 | XSDLocator* getLocator() const;
|
---|
| 135 | const XMLCh* getTypeLocalName() const;
|
---|
| 136 | const XMLCh* getTypeUri() const;
|
---|
| 137 |
|
---|
| 138 | /**
|
---|
| 139 | * returns true if this type is anonymous
|
---|
| 140 | **/
|
---|
| 141 | bool getAnonymous() const;
|
---|
| 142 |
|
---|
| 143 | // -----------------------------------------------------------------------
|
---|
| 144 | // Setter methods
|
---|
| 145 | // -----------------------------------------------------------------------
|
---|
| 146 | void setAbstract(const bool isAbstract);
|
---|
| 147 | void setAdoptContentSpec(const bool toAdopt);
|
---|
| 148 | void setAttWithTypeId(const bool value);
|
---|
| 149 | void setPreprocessed(const bool aValue = true);
|
---|
| 150 | void setDerivedBy(const int derivedBy);
|
---|
| 151 | void setBlockSet(const int blockSet);
|
---|
| 152 | void setFinalSet(const int finalSet);
|
---|
| 153 | void setScopeDefined(const int scopeDefined);
|
---|
| 154 | void setElementId(const unsigned int elemId);
|
---|
| 155 | void setTypeName(const XMLCh* const typeName);
|
---|
| 156 | void setContentType(const int contentType);
|
---|
| 157 | void setBaseDatatypeValidator(DatatypeValidator* const baseValidator);
|
---|
| 158 | void setDatatypeValidator(DatatypeValidator* const validator);
|
---|
| 159 | void setBaseComplexTypeInfo(ComplexTypeInfo* const typeInfo);
|
---|
| 160 | void setContentSpec(ContentSpecNode* const toAdopt);
|
---|
| 161 | void setAttWildCard(SchemaAttDef* const toAdopt);
|
---|
| 162 | void addAttDef(SchemaAttDef* const toAdd);
|
---|
| 163 | void addElement(SchemaElementDecl* const toAdd);
|
---|
| 164 | void setContentModel(XMLContentModel* const newModelToAdopt);
|
---|
| 165 | void setLocator(XSDLocator* const aLocator);
|
---|
| 166 |
|
---|
| 167 | /**
|
---|
| 168 | * sets this type to be anonymous
|
---|
| 169 | **/
|
---|
| 170 | void setAnonymous();
|
---|
| 171 |
|
---|
| 172 | // -----------------------------------------------------------------------
|
---|
| 173 | // Helper methods
|
---|
| 174 | // -----------------------------------------------------------------------
|
---|
| 175 | bool hasAttDefs() const;
|
---|
| 176 | bool contains(const XMLCh* const attName);
|
---|
| 177 | XMLAttDef* findAttr
|
---|
| 178 | (
|
---|
| 179 | const XMLCh* const qName
|
---|
| 180 | , const unsigned int uriId
|
---|
| 181 | , const XMLCh* const baseName
|
---|
| 182 | , const XMLCh* const prefix
|
---|
| 183 | , const XMLElementDecl::LookupOpts options
|
---|
| 184 | , bool& wasAdded
|
---|
| 185 | ) const;
|
---|
| 186 | bool resetDefs();
|
---|
| 187 | void checkUniqueParticleAttribution
|
---|
| 188 | (
|
---|
| 189 | SchemaGrammar* const pGrammar
|
---|
| 190 | , GrammarResolver* const pGrammarResolver
|
---|
| 191 | , XMLStringPool* const pStringPool
|
---|
| 192 | , XMLValidator* const pValidator
|
---|
| 193 | ) ;
|
---|
| 194 |
|
---|
| 195 | /**
|
---|
| 196 | * Return a singleton that represents 'anyType'
|
---|
| 197 | *
|
---|
| 198 | * @param emptyNSId the uri id of the empty namespace
|
---|
| 199 | */
|
---|
| 200 | static ComplexTypeInfo* getAnyType(unsigned int emptyNSId);
|
---|
| 201 |
|
---|
| 202 | /**
|
---|
| 203 | * Notification that lazy data has been deleted
|
---|
| 204 | */
|
---|
| 205 | static void reinitAnyType();
|
---|
| 206 |
|
---|
| 207 | /***
|
---|
| 208 | * Support for Serialization/De-serialization
|
---|
| 209 | ***/
|
---|
| 210 | DECL_XSERIALIZABLE(ComplexTypeInfo)
|
---|
| 211 |
|
---|
| 212 | private:
|
---|
| 213 | // -----------------------------------------------------------------------
|
---|
| 214 | // Unimplemented contstructors and operators
|
---|
| 215 | // -----------------------------------------------------------------------
|
---|
| 216 | ComplexTypeInfo(const ComplexTypeInfo& elemInfo);
|
---|
| 217 | ComplexTypeInfo& operator= (const ComplexTypeInfo& other);
|
---|
| 218 |
|
---|
| 219 | // -----------------------------------------------------------------------
|
---|
| 220 | // Private helper methods
|
---|
| 221 | // -----------------------------------------------------------------------
|
---|
| 222 | void faultInAttDefList() const;
|
---|
| 223 | XMLContentModel* createChildModel(ContentSpecNode* specNode, const bool isMixed);
|
---|
| 224 | XMLContentModel* makeContentModel(const bool checkUPA = false, ContentSpecNode* const specNode = 0);
|
---|
| 225 | XMLContentModel* buildContentModel(ContentSpecNode* const specNode);
|
---|
| 226 | XMLCh* formatContentModel () const ;
|
---|
| 227 | ContentSpecNode* expandContentModel(ContentSpecNode* const curNode, const int minOccurs, const int maxOccurs);
|
---|
| 228 | ContentSpecNode* convertContentSpecTree(ContentSpecNode* const curNode, const bool checkUPA = false);
|
---|
| 229 | void resizeContentSpecOrgURI();
|
---|
| 230 |
|
---|
| 231 | // -----------------------------------------------------------------------
|
---|
| 232 | // Private data members
|
---|
| 233 | // -----------------------------------------------------------------------
|
---|
| 234 | bool fAnonymous;
|
---|
| 235 | bool fAbstract;
|
---|
| 236 | bool fAdoptContentSpec;
|
---|
| 237 | bool fAttWithTypeId;
|
---|
| 238 | bool fPreprocessed;
|
---|
| 239 | int fDerivedBy;
|
---|
| 240 | int fBlockSet;
|
---|
| 241 | int fFinalSet;
|
---|
| 242 | int fScopeDefined;
|
---|
| 243 | unsigned int fElementId;
|
---|
| 244 | int fContentType;
|
---|
| 245 | XMLCh* fTypeName;
|
---|
| 246 | XMLCh* fTypeLocalName;
|
---|
| 247 | XMLCh* fTypeUri;
|
---|
| 248 | DatatypeValidator* fBaseDatatypeValidator;
|
---|
| 249 | DatatypeValidator* fDatatypeValidator;
|
---|
| 250 | ComplexTypeInfo* fBaseComplexTypeInfo;
|
---|
| 251 | ContentSpecNode* fContentSpec;
|
---|
| 252 | SchemaAttDef* fAttWildCard;
|
---|
| 253 | SchemaAttDefList* fAttList;
|
---|
| 254 | RefVectorOf<SchemaElementDecl>* fElements;
|
---|
| 255 | RefVectorOf<ContentSpecNode>* fSpecNodesToDelete;
|
---|
| 256 | RefHash2KeysTableOf<SchemaAttDef>* fAttDefs;
|
---|
| 257 | XMLContentModel* fContentModel;
|
---|
| 258 | XMLCh* fFormattedModel;
|
---|
| 259 | unsigned int* fContentSpecOrgURI;
|
---|
| 260 | unsigned int fUniqueURI;
|
---|
| 261 | unsigned int fContentSpecOrgURISize;
|
---|
| 262 | XSDLocator* fLocator;
|
---|
| 263 | MemoryManager* fMemoryManager;
|
---|
| 264 |
|
---|
| 265 | static ComplexTypeInfo* fAnyType;
|
---|
| 266 | };
|
---|
| 267 |
|
---|
| 268 | // ---------------------------------------------------------------------------
|
---|
| 269 | // ComplexTypeInfo: Getter methods
|
---|
| 270 | // ---------------------------------------------------------------------------
|
---|
| 271 | inline bool ComplexTypeInfo::getAbstract() const {
|
---|
| 272 |
|
---|
| 273 | return fAbstract;
|
---|
| 274 | }
|
---|
| 275 |
|
---|
| 276 | inline bool ComplexTypeInfo::getAdoptContentSpec() const {
|
---|
| 277 |
|
---|
| 278 | return fAdoptContentSpec;
|
---|
| 279 | }
|
---|
| 280 |
|
---|
| 281 | inline bool ComplexTypeInfo::containsAttWithTypeId() const {
|
---|
| 282 |
|
---|
| 283 | return fAttWithTypeId;
|
---|
| 284 | }
|
---|
| 285 |
|
---|
| 286 | inline bool ComplexTypeInfo::getPreprocessed() const {
|
---|
| 287 |
|
---|
| 288 | return fPreprocessed;
|
---|
| 289 | }
|
---|
| 290 |
|
---|
| 291 | inline int ComplexTypeInfo::getDerivedBy() const {
|
---|
| 292 |
|
---|
| 293 | return fDerivedBy;
|
---|
| 294 | }
|
---|
| 295 |
|
---|
| 296 | inline int ComplexTypeInfo::getBlockSet() const {
|
---|
| 297 |
|
---|
| 298 | return fBlockSet;
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | inline int ComplexTypeInfo::getFinalSet() const {
|
---|
| 302 |
|
---|
| 303 | return fFinalSet;
|
---|
| 304 | }
|
---|
| 305 |
|
---|
| 306 | inline int ComplexTypeInfo::getScopeDefined() const {
|
---|
| 307 |
|
---|
| 308 | return fScopeDefined;
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | inline unsigned int ComplexTypeInfo::getElementId() const {
|
---|
| 312 |
|
---|
| 313 | return fElementId;
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | inline int ComplexTypeInfo::getContentType() const {
|
---|
| 317 |
|
---|
| 318 | return fContentType;
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | inline unsigned int ComplexTypeInfo::elementCount() const {
|
---|
| 322 |
|
---|
| 323 | if (fElements) {
|
---|
| 324 | return fElements->size();
|
---|
| 325 | }
|
---|
| 326 |
|
---|
| 327 | return 0;
|
---|
| 328 | }
|
---|
| 329 |
|
---|
| 330 | inline XMLCh* ComplexTypeInfo::getTypeName() const {
|
---|
| 331 | return fTypeName;
|
---|
| 332 | }
|
---|
| 333 |
|
---|
| 334 | inline DatatypeValidator* ComplexTypeInfo::getBaseDatatypeValidator() const {
|
---|
| 335 |
|
---|
| 336 | return fBaseDatatypeValidator;
|
---|
| 337 | }
|
---|
| 338 |
|
---|
| 339 | inline DatatypeValidator* ComplexTypeInfo::getDatatypeValidator() const {
|
---|
| 340 |
|
---|
| 341 | return fDatatypeValidator;
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | inline ComplexTypeInfo* ComplexTypeInfo::getBaseComplexTypeInfo() const {
|
---|
| 345 |
|
---|
| 346 | return fBaseComplexTypeInfo;
|
---|
| 347 | }
|
---|
| 348 |
|
---|
| 349 | inline ContentSpecNode* ComplexTypeInfo::getContentSpec() const {
|
---|
| 350 |
|
---|
| 351 | return fContentSpec;
|
---|
| 352 | }
|
---|
| 353 |
|
---|
| 354 | inline const SchemaAttDef* ComplexTypeInfo::getAttWildCard() const {
|
---|
| 355 |
|
---|
| 356 | return fAttWildCard;
|
---|
| 357 | }
|
---|
| 358 |
|
---|
| 359 | inline SchemaAttDef* ComplexTypeInfo::getAttWildCard() {
|
---|
| 360 |
|
---|
| 361 | return fAttWildCard;
|
---|
| 362 | }
|
---|
| 363 |
|
---|
| 364 | inline const SchemaAttDef* ComplexTypeInfo::getAttDef(const XMLCh* const baseName,
|
---|
| 365 | const int uriId) const {
|
---|
| 366 |
|
---|
| 367 | // If no list, then return a null
|
---|
| 368 | if (!fAttDefs)
|
---|
| 369 | return 0;
|
---|
| 370 |
|
---|
| 371 | return fAttDefs->get(baseName, uriId);
|
---|
| 372 | }
|
---|
| 373 |
|
---|
| 374 | inline SchemaAttDef* ComplexTypeInfo::getAttDef(const XMLCh* const baseName,
|
---|
| 375 | const int uriId)
|
---|
| 376 | {
|
---|
| 377 | // If no list, then return a null
|
---|
| 378 | if (!fAttDefs)
|
---|
| 379 | return 0;
|
---|
| 380 |
|
---|
| 381 | return fAttDefs->get(baseName, uriId);
|
---|
| 382 | }
|
---|
| 383 |
|
---|
| 384 | inline SchemaElementDecl*
|
---|
| 385 | ComplexTypeInfo::elementAt(const unsigned int index) {
|
---|
| 386 |
|
---|
| 387 | if (!fElements) {
|
---|
| 388 | return 0; // REVISIT - need to throw an exception
|
---|
| 389 | }
|
---|
| 390 |
|
---|
| 391 | return fElements->elementAt(index);
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | inline const SchemaElementDecl*
|
---|
| 395 | ComplexTypeInfo::elementAt(const unsigned int index) const {
|
---|
| 396 |
|
---|
| 397 | if (!fElements) {
|
---|
| 398 | return 0; // REVISIT - need to throw an exception
|
---|
| 399 | }
|
---|
| 400 |
|
---|
| 401 | return fElements->elementAt(index);
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | inline XMLContentModel* ComplexTypeInfo::getContentModel(const bool checkUPA)
|
---|
| 405 | {
|
---|
| 406 | if (!fContentModel)
|
---|
| 407 | fContentModel = makeContentModel(checkUPA);
|
---|
| 408 |
|
---|
| 409 | return fContentModel;
|
---|
| 410 | }
|
---|
| 411 |
|
---|
| 412 | inline XSDLocator* ComplexTypeInfo::getLocator() const
|
---|
| 413 | {
|
---|
| 414 | return fLocator;
|
---|
| 415 | }
|
---|
| 416 |
|
---|
| 417 | inline bool ComplexTypeInfo::getAnonymous() const {
|
---|
| 418 | return fAnonymous;
|
---|
| 419 | }
|
---|
| 420 |
|
---|
| 421 | inline const XMLCh* ComplexTypeInfo::getTypeLocalName() const
|
---|
| 422 | {
|
---|
| 423 | if(!fTypeLocalName) {
|
---|
| 424 | int index = XMLString::indexOf(fTypeName, chComma);
|
---|
| 425 | int length = XMLString::stringLen(fTypeName);
|
---|
| 426 | XMLCh *tName = (XMLCh*) fMemoryManager->allocate
|
---|
| 427 | (
|
---|
| 428 | (length - index + 1) * sizeof(XMLCh)
|
---|
| 429 | ); //new XMLCh[length - index + 1];
|
---|
| 430 | XMLString::subString(tName, fTypeName, index + 1, length, fMemoryManager);
|
---|
| 431 | ((ComplexTypeInfo *)this)->fTypeLocalName = tName;
|
---|
| 432 | }
|
---|
| 433 |
|
---|
| 434 | return fTypeLocalName;
|
---|
| 435 | }
|
---|
| 436 |
|
---|
| 437 | inline const XMLCh* ComplexTypeInfo::getTypeUri() const
|
---|
| 438 | {
|
---|
| 439 | if(!fTypeUri) {
|
---|
| 440 | int index = XMLString::indexOf(fTypeName, chComma);
|
---|
| 441 | XMLCh *uri = (XMLCh*) fMemoryManager->allocate
|
---|
| 442 | (
|
---|
| 443 | (index + 1) * sizeof(XMLCh)
|
---|
| 444 | ); //new XMLCh[index + 1];
|
---|
| 445 | XMLString::subString(uri, fTypeName, 0, index, fMemoryManager);
|
---|
| 446 | ((ComplexTypeInfo *)this)->fTypeUri = uri;
|
---|
| 447 | }
|
---|
| 448 |
|
---|
| 449 | return fTypeUri;
|
---|
| 450 | }
|
---|
| 451 |
|
---|
| 452 | // ---------------------------------------------------------------------------
|
---|
| 453 | // ComplexTypeInfo: Setter methods
|
---|
| 454 | // ---------------------------------------------------------------------------
|
---|
| 455 | inline void ComplexTypeInfo::setAbstract(const bool isAbstract) {
|
---|
| 456 |
|
---|
| 457 | fAbstract = isAbstract;
|
---|
| 458 | }
|
---|
| 459 |
|
---|
| 460 | inline void ComplexTypeInfo::setAdoptContentSpec(const bool toAdopt) {
|
---|
| 461 |
|
---|
| 462 | fAdoptContentSpec = toAdopt;
|
---|
| 463 | }
|
---|
| 464 |
|
---|
| 465 | inline void ComplexTypeInfo::setAttWithTypeId(const bool value) {
|
---|
| 466 |
|
---|
| 467 | fAttWithTypeId = value;
|
---|
| 468 | }
|
---|
| 469 |
|
---|
| 470 | inline void ComplexTypeInfo::setPreprocessed(const bool aValue) {
|
---|
| 471 |
|
---|
| 472 | fPreprocessed = aValue;
|
---|
| 473 | }
|
---|
| 474 |
|
---|
| 475 | inline void ComplexTypeInfo::setDerivedBy(const int derivedBy) {
|
---|
| 476 |
|
---|
| 477 | fDerivedBy = derivedBy;
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 | inline void ComplexTypeInfo::setBlockSet(const int blockSet) {
|
---|
| 481 |
|
---|
| 482 | fBlockSet = blockSet;
|
---|
| 483 | }
|
---|
| 484 |
|
---|
| 485 | inline void ComplexTypeInfo::setFinalSet(const int finalSet) {
|
---|
| 486 |
|
---|
| 487 | fFinalSet = finalSet;
|
---|
| 488 | }
|
---|
| 489 |
|
---|
| 490 | inline void ComplexTypeInfo::setScopeDefined(const int scopeDefined) {
|
---|
| 491 |
|
---|
| 492 | fScopeDefined = scopeDefined;
|
---|
| 493 | }
|
---|
| 494 |
|
---|
| 495 | inline void ComplexTypeInfo::setElementId(const unsigned int elemId) {
|
---|
| 496 |
|
---|
| 497 | fElementId = elemId;
|
---|
| 498 | }
|
---|
| 499 |
|
---|
| 500 | inline void
|
---|
| 501 | ComplexTypeInfo::setContentType(const int contentType) {
|
---|
| 502 |
|
---|
| 503 | fContentType = contentType;
|
---|
| 504 | }
|
---|
| 505 |
|
---|
| 506 | inline void ComplexTypeInfo::setTypeName(const XMLCh* const typeName) {
|
---|
| 507 |
|
---|
| 508 | fMemoryManager->deallocate(fTypeName);//delete [] fTypeName;
|
---|
| 509 | fMemoryManager->deallocate(fTypeLocalName);//delete [] fTypeLocalName;
|
---|
| 510 | fMemoryManager->deallocate(fTypeUri);//delete [] fTypeUri;
|
---|
| 511 | fTypeLocalName = fTypeUri = 0;
|
---|
| 512 |
|
---|
| 513 | fTypeName = XMLString::replicate(typeName, fMemoryManager);
|
---|
| 514 | }
|
---|
| 515 |
|
---|
| 516 | inline void
|
---|
| 517 | ComplexTypeInfo::setBaseDatatypeValidator(DatatypeValidator* const validator) {
|
---|
| 518 |
|
---|
| 519 | fBaseDatatypeValidator = validator;
|
---|
| 520 | }
|
---|
| 521 |
|
---|
| 522 | inline void
|
---|
| 523 | ComplexTypeInfo::setDatatypeValidator(DatatypeValidator* const validator) {
|
---|
| 524 |
|
---|
| 525 | fDatatypeValidator = validator;
|
---|
| 526 | }
|
---|
| 527 |
|
---|
| 528 | inline void
|
---|
| 529 | ComplexTypeInfo::setBaseComplexTypeInfo(ComplexTypeInfo* const typeInfo) {
|
---|
| 530 |
|
---|
| 531 | fBaseComplexTypeInfo = typeInfo;
|
---|
| 532 | }
|
---|
| 533 |
|
---|
| 534 | inline void ComplexTypeInfo::addElement(SchemaElementDecl* const elem) {
|
---|
| 535 |
|
---|
| 536 | if (!fElements) {
|
---|
| 537 | fElements = new (fMemoryManager) RefVectorOf<SchemaElementDecl>(8, false, fMemoryManager);
|
---|
| 538 | }
|
---|
| 539 | else if (fElements->containsElement(elem)) {
|
---|
| 540 | return;
|
---|
| 541 | }
|
---|
| 542 |
|
---|
| 543 | fElements->addElement(elem);
|
---|
| 544 | }
|
---|
| 545 |
|
---|
| 546 | inline void ComplexTypeInfo::setAttWildCard(SchemaAttDef* const toAdopt) {
|
---|
| 547 |
|
---|
| 548 | if (fAttWildCard) {
|
---|
| 549 | delete fAttWildCard;
|
---|
| 550 | }
|
---|
| 551 |
|
---|
| 552 | fAttWildCard = toAdopt;
|
---|
| 553 | }
|
---|
| 554 |
|
---|
| 555 | inline void
|
---|
| 556 | ComplexTypeInfo::setContentModel(XMLContentModel* const newModelToAdopt)
|
---|
| 557 | {
|
---|
| 558 | delete fContentModel;
|
---|
| 559 | fContentModel = newModelToAdopt;
|
---|
| 560 |
|
---|
| 561 | // reset formattedModel
|
---|
| 562 | if (fFormattedModel)
|
---|
| 563 | {
|
---|
| 564 | fMemoryManager->deallocate(fFormattedModel);
|
---|
| 565 | fFormattedModel = 0;
|
---|
| 566 | }
|
---|
| 567 | }
|
---|
| 568 |
|
---|
| 569 |
|
---|
| 570 |
|
---|
| 571 | inline void ComplexTypeInfo::setAnonymous() {
|
---|
| 572 | fAnonymous = true;
|
---|
| 573 | }
|
---|
| 574 |
|
---|
| 575 | // ---------------------------------------------------------------------------
|
---|
| 576 | // ComplexTypeInfo: Helper methods
|
---|
| 577 | // ---------------------------------------------------------------------------
|
---|
| 578 | inline bool ComplexTypeInfo::hasAttDefs() const
|
---|
| 579 | {
|
---|
| 580 | // If the collection hasn't been faulted in, then no att defs
|
---|
| 581 | if (!fAttDefs)
|
---|
| 582 | return false;
|
---|
| 583 |
|
---|
| 584 | return !fAttDefs->isEmpty();
|
---|
| 585 | }
|
---|
| 586 |
|
---|
| 587 | inline bool ComplexTypeInfo::contains(const XMLCh* const attName) {
|
---|
| 588 |
|
---|
| 589 | if (!fAttDefs) {
|
---|
| 590 | return false;
|
---|
| 591 | }
|
---|
| 592 |
|
---|
| 593 | RefHash2KeysTableOfEnumerator<SchemaAttDef> enumDefs(fAttDefs, false, fMemoryManager);
|
---|
| 594 |
|
---|
| 595 | while (enumDefs.hasMoreElements()) {
|
---|
| 596 |
|
---|
| 597 | if (XMLString::equals(attName, enumDefs.nextElement().getAttName()->getLocalPart())) {
|
---|
| 598 | return true;
|
---|
| 599 | }
|
---|
| 600 | }
|
---|
| 601 |
|
---|
| 602 | return false;
|
---|
| 603 | }
|
---|
| 604 |
|
---|
| 605 | XERCES_CPP_NAMESPACE_END
|
---|
| 606 |
|
---|
| 607 | #endif
|
---|
| 608 |
|
---|
| 609 | /**
|
---|
| 610 | * End of file ComplexTypeInfo.hpp
|
---|
| 611 | */
|
---|
| 612 |
|
---|