File indexing completed on 2025-01-18 10:15:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #if !defined(XERCESC_INCLUDE_GUARD_TRAVERSESCHEMA_HPP)
0023 #define XERCESC_INCLUDE_GUARD_TRAVERSESCHEMA_HPP
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include <xercesc/util/XMLUniDefs.hpp>
0034 #include <xercesc/dom/DOMElement.hpp>
0035 #include <xercesc/dom/DOMAttr.hpp>
0036 #include <xercesc/framework/XMLBuffer.hpp>
0037 #include <xercesc/framework/XMLErrorCodes.hpp>
0038 #include <xercesc/validators/schema/SchemaSymbols.hpp>
0039 #include <xercesc/util/ValueVectorOf.hpp>
0040 #include <xercesc/util/RefHash2KeysTableOf.hpp>
0041 #include <xercesc/validators/common/ContentSpecNode.hpp>
0042 #include <xercesc/validators/schema/SchemaGrammar.hpp>
0043 #include <xercesc/validators/schema/SchemaInfo.hpp>
0044 #include <xercesc/validators/schema/GeneralAttributeCheck.hpp>
0045 #include <xercesc/validators/schema/XSDErrorReporter.hpp>
0046 #include <xercesc/util/XMLResourceIdentifier.hpp>
0047
0048 XERCES_CPP_NAMESPACE_BEGIN
0049
0050
0051
0052
0053 class GrammarResolver;
0054 class XMLEntityHandler;
0055 class XMLScanner;
0056 class DatatypeValidator;
0057 class DatatypeValidatorFactory;
0058 class QName;
0059 class ComplexTypeInfo;
0060 class XMLAttDef;
0061 class NamespaceScope;
0062 class SchemaAttDef;
0063 class InputSource;
0064 class XercesGroupInfo;
0065 class XercesAttGroupInfo;
0066 class IdentityConstraint;
0067 class XSDLocator;
0068 class XSDDOMParser;
0069 class XMLErrorReporter;
0070
0071
0072 class VALIDATORS_EXPORT TraverseSchema : public XMemory
0073 {
0074 public:
0075
0076
0077
0078 TraverseSchema
0079 (
0080 DOMElement* const schemaRoot
0081 , XMLStringPool* const uriStringPool
0082 , SchemaGrammar* const schemaGrammar
0083 , GrammarResolver* const grammarResolver
0084 , RefHash2KeysTableOf<SchemaInfo>* cachedSchemaInfoList
0085 , RefHash2KeysTableOf<SchemaInfo>* schemaInfoList
0086 , XMLScanner* const xmlScanner
0087 , const XMLCh* const schemaURL
0088 , XMLEntityHandler* const entityHandler
0089 , XMLErrorReporter* const errorReporter
0090 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0091 , bool multipleImport = false
0092 );
0093
0094 ~TraverseSchema();
0095
0096 private:
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108 enum
0109 {
0110 Not_All_Context = 0
0111 , All_Element = 1
0112 , Group_Ref_With_All = 2
0113 , All_Group = 4
0114 };
0115
0116
0117
0118
0119 TraverseSchema(const TraverseSchema&);
0120 TraverseSchema& operator=(const TraverseSchema&);
0121
0122
0123
0124
0125 void init();
0126 void cleanUp();
0127
0128
0129
0130
0131
0132
0133
0134 void doTraverseSchema(const DOMElement* const schemaRoot);
0135 void preprocessSchema(DOMElement* const schemaRoot,
0136 const XMLCh* const schemaURL,
0137 bool multipleImport = false);
0138 void traverseSchemaHeader(const DOMElement* const schemaRoot);
0139 XSAnnotation* traverseAnnotationDecl(const DOMElement* const childElem,
0140 ValueVectorOf<DOMNode*>* const nonXSAttList,
0141 const bool topLevel = false);
0142 void traverseInclude(const DOMElement* const childElem);
0143 void traverseImport(const DOMElement* const childElem);
0144 void traverseRedefine(const DOMElement* const childElem);
0145 void traverseAttributeDecl(const DOMElement* const childElem,
0146 ComplexTypeInfo* const typeInfo,
0147 const bool topLevel = false);
0148 void traverseSimpleContentDecl(const XMLCh* const typeName,
0149 const XMLCh* const qualifiedName,
0150 const DOMElement* const contentDecl,
0151 ComplexTypeInfo* const typeInfo,
0152 Janitor<XSAnnotation>* const janAnnot);
0153 void traverseComplexContentDecl(const XMLCh* const typeName,
0154 const DOMElement* const contentDecl,
0155 ComplexTypeInfo* const typeInfo,
0156 const bool isMixed,
0157 Janitor<XSAnnotation>* const janAnnot);
0158 DatatypeValidator* traverseSimpleTypeDecl(const DOMElement* const childElem,
0159 const bool topLevel = true,
0160 int baseRefContext = SchemaSymbols::XSD_EMPTYSET);
0161 int traverseComplexTypeDecl(const DOMElement* const childElem,
0162 const bool topLevel = true,
0163 const XMLCh* const recursingTypeName = 0);
0164 DatatypeValidator* traverseByList(const DOMElement* const rootElem,
0165 const DOMElement* const contentElem,
0166 const XMLCh* const typeName,
0167 const XMLCh* const qualifiedName,
0168 const int finalSet,
0169 Janitor<XSAnnotation>* const janAnnot);
0170 DatatypeValidator* traverseByRestriction(const DOMElement* const rootElem,
0171 const DOMElement* const contentElem,
0172 const XMLCh* const typeName,
0173 const XMLCh* const qualifiedName,
0174 const int finalSet,
0175 Janitor<XSAnnotation>* const janAnnot);
0176 DatatypeValidator* traverseByUnion(const DOMElement* const rootElem,
0177 const DOMElement* const contentElem,
0178 const XMLCh* const typeName,
0179 const XMLCh* const qualifiedName,
0180 const int finalSet,
0181 int baseRefContext,
0182 Janitor<XSAnnotation>* const janAnnot);
0183 SchemaElementDecl* traverseElementDecl(const DOMElement* const childElem,
0184 const bool topLevel = false);
0185 const XMLCh* traverseNotationDecl(const DOMElement* const childElem);
0186 const XMLCh* traverseNotationDecl(const DOMElement* const childElem,
0187 const XMLCh* const name,
0188 const XMLCh* const uriStr);
0189 ContentSpecNode* traverseChoiceSequence(const DOMElement* const elemDecl,
0190 const int modelGroupType,
0191 bool& hasChildren);
0192 ContentSpecNode* traverseAny(const DOMElement* const anyDecl);
0193 ContentSpecNode* traverseAll(const DOMElement* const allElem,
0194 bool& hasChildren);
0195 XercesGroupInfo* traverseGroupDecl(const DOMElement* const childElem,
0196 const bool topLevel = true);
0197 XercesAttGroupInfo* traverseAttributeGroupDecl(const DOMElement* const elem,
0198 ComplexTypeInfo* const typeInfo,
0199 const bool topLevel = false);
0200 XercesAttGroupInfo* traverseAttributeGroupDeclNS(const DOMElement* const elem,
0201 const XMLCh* const uriStr,
0202 const XMLCh* const name);
0203 SchemaAttDef* traverseAnyAttribute(const DOMElement* const elem);
0204 void traverseKey(const DOMElement* const icElem,
0205 SchemaElementDecl* const elemDecl);
0206 void traverseUnique(const DOMElement* const icElem,
0207 SchemaElementDecl* const elemDecl);
0208 void traverseKeyRef(const DOMElement* const icElem,
0209 SchemaElementDecl* const elemDecl);
0210 bool traverseIdentityConstraint(IdentityConstraint* const ic,
0211 const DOMElement* const icElem);
0212
0213
0214
0215
0216 void reportSchemaError(const XSDLocator* const aLocator,
0217 const XMLCh* const msgDomain,
0218 const int errorCode);
0219 void reportSchemaError(const XSDLocator* const aLocator,
0220 const XMLCh* const msgDomain,
0221 const int errorCode,
0222 const XMLCh* const text1,
0223 const XMLCh* const text2 = 0,
0224 const XMLCh* const text3 = 0,
0225 const XMLCh* const text4 = 0);
0226 void reportSchemaError(const DOMElement* const elem,
0227 const XMLCh* const msgDomain,
0228 const int errorCode);
0229 void reportSchemaError(const DOMElement* const elem,
0230 const XMLCh* const msgDomain,
0231 const int errorCode,
0232 const XMLCh* const text1,
0233 const XMLCh* const text2 = 0,
0234 const XMLCh* const text3 = 0,
0235 const XMLCh* const text4 = 0);
0236 void reportSchemaError(const DOMElement* const elem,
0237 const XMLException& except);
0238
0239
0240
0241
0242
0243
0244
0245 bool isImportingNS(const int namespaceURI);
0246 void addImportedNS(const int namespaceURI);
0247
0248
0249
0250
0251 bool retrieveNamespaceMapping(const DOMElement* const elem);
0252
0253
0254
0255
0256
0257 void processChildren(const DOMElement* const root);
0258 void preprocessChildren(const DOMElement* const root);
0259
0260 void preprocessImport(const DOMElement* const elemNode);
0261 void preprocessInclude(const DOMElement* const elemNode);
0262 void preprocessRedefine(const DOMElement* const elemNode);
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276 DOMElement* checkContent(const DOMElement* const rootElem,
0277 DOMElement* const contentElem,
0278 const bool isEmpty, bool processAnnot = true);
0279
0280
0281
0282
0283
0284
0285
0286 const DOMElement* checkIdentityConstraintContent(const DOMElement* const contentElem);
0287
0288 DatatypeValidator* getDatatypeValidator(const XMLCh* const uriStr,
0289 const XMLCh* const localPartStr);
0290
0291
0292
0293
0294
0295 DatatypeValidator* checkForSimpleTypeValidator(const DOMElement* const content,
0296 int baseRefContext = SchemaSymbols::XSD_EMPTYSET);
0297
0298
0299
0300
0301
0302 ComplexTypeInfo* checkForComplexTypeInfo(const DOMElement* const content);
0303
0304
0305
0306
0307 DatatypeValidator* findDTValidator(const DOMElement* const elem,
0308 const XMLCh* const derivedTypeName,
0309 const XMLCh* const baseTypeName,
0310 const int baseRefContext);
0311
0312 const XMLCh* resolvePrefixToURI(const DOMElement* const elem,
0313 const XMLCh* const prefix);
0314
0315
0316
0317
0318
0319
0320
0321 const XMLCh* getPrefix(const XMLCh* const rawName);
0322
0323
0324
0325
0326
0327
0328 const XMLCh* getLocalPart(const XMLCh* const rawName);
0329
0330
0331
0332
0333 SchemaElementDecl* processElementDeclRef(const DOMElement* const elem,
0334 const XMLCh* const refName);
0335 void processElemDeclAttrs(const DOMElement* const elem,
0336 SchemaElementDecl* const elemDecl,
0337 const XMLCh*& valConstraint,
0338 bool isTopLevel = false);
0339 void processElemDeclIC(DOMElement* const elem,
0340 SchemaElementDecl* const elemDecl);
0341 bool checkElemDeclValueConstraint(const DOMElement* const elem,
0342 SchemaElementDecl* const elemDecl,
0343 const XMLCh* const valConstraint,
0344 ComplexTypeInfo* const typeInfo,
0345 DatatypeValidator* const validator);
0346
0347
0348
0349
0350 void processAttributeDeclRef(const DOMElement* const elem,
0351 ComplexTypeInfo* const typeInfo,
0352 const XMLCh* const refName,
0353 const XMLCh* const useVal,
0354 const XMLCh* const defaultVal,
0355 const XMLCh* const fixedVal);
0356
0357
0358
0359
0360 XercesGroupInfo* processGroupRef(const DOMElement* const elem,
0361 const XMLCh* const refName);
0362
0363
0364
0365
0366 XercesAttGroupInfo* processAttributeGroupRef(const DOMElement* const elem,
0367 const XMLCh* const refName,
0368 ComplexTypeInfo* const typeInfo);
0369
0370
0371
0372
0373 int parseBlockSet(const DOMElement* const elem, const int blockType, const bool isRoot = false);
0374 int parseFinalSet(const DOMElement* const elem, const int finalType, const bool isRoot = false);
0375
0376
0377
0378
0379 bool isIdentityConstraintName(const XMLCh* const constraintName);
0380
0381
0382
0383
0384
0385 const XMLCh* checkTypeFromAnotherSchema(const DOMElement* const elem,
0386 const XMLCh* const typeStr);
0387
0388
0389
0390
0391
0392 DatatypeValidator* getElementTypeValidator(const DOMElement* const elem,
0393 const XMLCh* const typeStr,
0394 bool& noErrorDetected,
0395 const XMLCh* const otherSchemaURI);
0396
0397
0398
0399
0400
0401 ComplexTypeInfo* getElementComplexTypeInfo(const DOMElement* const elem,
0402 const XMLCh* const typeStr,
0403 const XMLCh* const otherSchemaURI);
0404
0405
0406
0407
0408 SchemaElementDecl* getGlobalElemDecl(const DOMElement* const elem,
0409 const XMLCh* const name);
0410
0411
0412
0413
0414
0415 bool isSubstitutionGroupValid(const DOMElement* const elem,
0416 const SchemaElementDecl* const elemDecl,
0417 const ComplexTypeInfo* const typeInfo,
0418 const DatatypeValidator* const validator,
0419 const XMLCh* const elemName,
0420 const bool toEmit = true);
0421
0422 bool isSubstitutionGroupCircular(SchemaElementDecl* const elemDecl,
0423 SchemaElementDecl* const subsElemDecl);
0424
0425 void processSubstitutionGroup(const DOMElement* const elem,
0426 SchemaElementDecl* const elemDecl,
0427 ComplexTypeInfo*& typeInfo,
0428 DatatypeValidator*& validator,
0429 const XMLCh* const subsElemQName);
0430
0431
0432
0433
0434 SchemaElementDecl* createSchemaElementDecl(const DOMElement* const elem,
0435 const XMLCh* const name,
0436 bool& isDuplicate,
0437 const XMLCh*& valConstraint,
0438 const bool topLevel);
0439
0440
0441
0442
0443 const XMLCh* getElementAttValue(const DOMElement* const elem,
0444 const XMLCh* const attName,
0445 const DatatypeValidator::ValidatorType attType = DatatypeValidator::UnKnown);
0446
0447
0448 int checkMinMax(ContentSpecNode* const specNode,
0449 const DOMElement* const elem,
0450 const int allContext = Not_All_Context);
0451
0452
0453
0454
0455 void processComplexContent(const DOMElement* const elem,
0456 const XMLCh* const typeName,
0457 const DOMElement* const childElem,
0458 ComplexTypeInfo* const typeInfo,
0459 const XMLCh* const baseLocalPart,
0460 const bool isMixed,
0461 const bool isBaseAnyType = false);
0462
0463
0464
0465
0466 void processBaseTypeInfo(const DOMElement* const elem,
0467 const XMLCh* const baseName,
0468 const XMLCh* const localPart,
0469 const XMLCh* const uriStr,
0470 ComplexTypeInfo* const typeInfo);
0471
0472
0473
0474
0475 bool isBaseFromAnotherSchema(const XMLCh* const baseURI);
0476
0477
0478
0479
0480 ComplexTypeInfo* getTypeInfoFromNS(const DOMElement* const elem,
0481 const XMLCh* const uriStr,
0482 const XMLCh* const localPart);
0483
0484 DatatypeValidator*
0485 getAttrDatatypeValidatorNS(const DOMElement* const elem,
0486 const XMLCh* localPart,
0487 const XMLCh* typeURI);
0488
0489
0490
0491
0492 bool isAttrOrAttrGroup(const DOMElement* const elem);
0493
0494
0495
0496
0497 void processAttributes(const DOMElement* const elem,
0498 const DOMElement* const attElem,
0499 ComplexTypeInfo* const typeInfo,
0500 const bool isBaseAnyType = false);
0501
0502
0503
0504
0505 const XMLCh* genAnonTypeName(const XMLCh* const prefix);
0506
0507 void defaultComplexTypeInfo(ComplexTypeInfo* const typeInfo);
0508
0509
0510
0511
0512
0513 InputSource* resolveSchemaLocation
0514 (
0515 const XMLCh* const loc
0516 , const XMLResourceIdentifier::ResourceIdentifierType resourceIdentitiferType
0517 , const XMLCh* const nameSpace=0
0518 );
0519
0520 void restoreSchemaInfo(SchemaInfo* const toRestore,
0521 SchemaInfo::ListType const aListType = SchemaInfo::INCLUDE,
0522 const unsigned int saveScope = Grammar::TOP_LEVEL_SCOPE);
0523 void popCurrentTypeNameStack();
0524
0525
0526
0527
0528
0529 bool emptiableParticle(const ContentSpecNode* const specNode);
0530
0531 void checkFixedFacet(const DOMElement* const, const XMLCh* const,
0532 const DatatypeValidator* const, unsigned int&);
0533 void buildValidSubstitutionListF(const DOMElement* const elem,
0534 SchemaElementDecl* const,
0535 SchemaElementDecl* const);
0536 void buildValidSubstitutionListB(const DOMElement* const elem,
0537 SchemaElementDecl* const,
0538 SchemaElementDecl* const);
0539
0540 void checkEnumerationRequiredNotation(const DOMElement* const elem,
0541 const XMLCh* const name,
0542 const XMLCh* const typeStr);
0543
0544 void processElements(const DOMElement* const elem,
0545 ComplexTypeInfo* const baseTypeInfo,
0546 ComplexTypeInfo* const newTypeInfo);
0547
0548 void processElements(const DOMElement* const elem,
0549 XercesGroupInfo* const fromGroup,
0550 ComplexTypeInfo* const typeInfo);
0551
0552 void copyGroupElements(const DOMElement* const elem,
0553 XercesGroupInfo* const fromGroup,
0554 XercesGroupInfo* const toGroup,
0555 ComplexTypeInfo* const typeInfo);
0556
0557 void copyAttGroupAttributes(const DOMElement* const elem,
0558 XercesAttGroupInfo* const fromAttGroup,
0559 XercesAttGroupInfo* const toAttGroup,
0560 ComplexTypeInfo* const typeInfo);
0561
0562 void checkForEmptyTargetNamespace(const DOMElement* const elem);
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574
0575 void attWildCardIntersection(SchemaAttDef* const resultWildCart,
0576 const SchemaAttDef* const toCompareWildCard);
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589 void attWildCardUnion(SchemaAttDef* const resultWildCart,
0590 const SchemaAttDef* const toCompareWildCard);
0591
0592 void copyWildCardData(const SchemaAttDef* const srcWildCard,
0593 SchemaAttDef* const destWildCard);
0594
0595
0596
0597
0598
0599 void checkAttDerivationOK(const DOMElement* const elem,
0600 const ComplexTypeInfo* const baseTypeInfo,
0601 const ComplexTypeInfo* const childTypeInfo);
0602 void checkAttDerivationOK(const DOMElement* const elem,
0603 const XercesAttGroupInfo* const baseAttGrpInfo,
0604 const XercesAttGroupInfo* const childAttGrpInfo);
0605
0606
0607
0608
0609
0610 bool wildcardAllowsNamespace(const SchemaAttDef* const baseAttWildCard,
0611 const unsigned int nameURI);
0612
0613
0614
0615
0616
0617 bool isWildCardSubset(const SchemaAttDef* const baseAttWildCard,
0618 const SchemaAttDef* const childAttWildCard);
0619
0620 bool openRedefinedSchema(const DOMElement* const redefineElem);
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630
0631
0632
0633
0634
0635
0636 void renameRedefinedComponents(const DOMElement* const redefineElem,
0637 SchemaInfo* const redefiningSchemaInfo,
0638 SchemaInfo* const redefinedSchemaInfo);
0639
0640
0641
0642
0643
0644 bool validateRedefineNameChange(const DOMElement* const redefineChildElem,
0645 const XMLCh* const redefineChildElemName,
0646 const XMLCh* const redefineChildDeclName,
0647 const int redefineNameCounter,
0648 SchemaInfo* const redefiningSchemaInfo);
0649
0650
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660 int changeRedefineGroup(const DOMElement* const redefineChildElem,
0661 const XMLCh* const redefineChildComponentName,
0662 const XMLCh* const redefineChildTypeName,
0663 const int redefineNameCounter);
0664
0665
0666
0667
0668
0669
0670
0671 void fixRedefinedSchema(const DOMElement* const elem,
0672 SchemaInfo* const redefinedSchemaInfo,
0673 const XMLCh* const redefineChildComponentName,
0674 const XMLCh* const redefineChildTypeName,
0675 const int redefineNameCounter);
0676
0677 void getRedefineNewTypeName(const XMLCh* const oldTypeName,
0678 const int redefineCounter,
0679 XMLBuffer& newTypeName);
0680
0681
0682
0683
0684
0685
0686
0687 void preprocessRedefineInclude(SchemaInfo* const currSchemaInfo);
0688
0689
0690
0691
0692
0693 void updateCircularSubstitutionList(SchemaInfo* const aSchemaInfo);
0694
0695 void processKeyRefFor(SchemaInfo* const aSchemaInfo,
0696 ValueVectorOf<SchemaInfo*>* const infoList);
0697
0698 void processAttValue(const XMLCh* const attVal, XMLBuffer& aBuf);
0699
0700
0701 XSAnnotation* generateSyntheticAnnotation(const DOMElement* const elem
0702 , ValueVectorOf<DOMNode*>* nonXSAttList);
0703
0704
0705 void validateAnnotations();
0706
0707
0708
0709
0710 enum
0711 {
0712 ES_Block
0713 , C_Block
0714 , S_Final
0715 , EC_Final
0716 , ECS_Final
0717 };
0718
0719 enum ExceptionCodes
0720 {
0721 NoException = 0,
0722 InvalidComplexTypeInfo = 1,
0723 RecursingElement = 2
0724 };
0725
0726 enum
0727 {
0728 Elem_Def_Qualified = 1,
0729 Attr_Def_Qualified = 2
0730 };
0731
0732
0733
0734
0735 bool fFullConstraintChecking;
0736 int fTargetNSURI;
0737 int fEmptyNamespaceURI;
0738 unsigned int fCurrentScope;
0739 unsigned int fScopeCount;
0740 unsigned int fAnonXSTypeCount;
0741 XMLSize_t fCircularCheckIndex;
0742 const XMLCh* fTargetNSURIString;
0743 DatatypeValidatorFactory* fDatatypeRegistry;
0744 GrammarResolver* fGrammarResolver;
0745 SchemaGrammar* fSchemaGrammar;
0746 XMLEntityHandler* fEntityHandler;
0747 XMLErrorReporter* fErrorReporter;
0748 XMLStringPool* fURIStringPool;
0749 XMLStringPool* fStringPool;
0750 XMLBuffer fBuffer;
0751 XMLScanner* fScanner;
0752 RefHashTableOf<XMLAttDef>* fAttributeDeclRegistry;
0753 RefHashTableOf<ComplexTypeInfo>* fComplexTypeRegistry;
0754 RefHashTableOf<XercesGroupInfo>* fGroupRegistry;
0755 RefHashTableOf<XercesAttGroupInfo>* fAttGroupRegistry;
0756 RefHashTableOf<ElemVector>* fIC_ElementsNS;
0757 RefHashTableOf<SchemaInfo, PtrHasher>* fPreprocessedNodes;
0758 SchemaInfo* fSchemaInfo;
0759 XercesGroupInfo* fCurrentGroupInfo;
0760 XercesAttGroupInfo* fCurrentAttGroupInfo;
0761 ComplexTypeInfo* fCurrentComplexType;
0762 ValueVectorOf<unsigned int>* fCurrentTypeNameStack;
0763 ValueVectorOf<unsigned int>* fCurrentGroupStack;
0764 ValueVectorOf<SchemaElementDecl*>* fIC_Elements;
0765 ValueVectorOf<const DOMElement*>* fDeclStack;
0766 ValueVectorOf<unsigned int>** fGlobalDeclarations;
0767 ValueVectorOf<DOMNode*>* fNonXSAttList;
0768 ValueVectorOf<int>* fImportedNSList;
0769 RefHashTableOf<ValueVectorOf<DOMElement*>, PtrHasher>* fIC_NodeListNS;
0770 RefHash2KeysTableOf<XMLCh>* fNotationRegistry;
0771 RefHash2KeysTableOf<XMLCh>* fRedefineComponents;
0772 RefHash2KeysTableOf<IdentityConstraint>* fIdentityConstraintNames;
0773 RefHash2KeysTableOf<ElemVector>* fValidSubstitutionGroups;
0774 RefHash2KeysTableOf<SchemaInfo>* fSchemaInfoList;
0775 RefHash2KeysTableOf<SchemaInfo>* fCachedSchemaInfoList;
0776 XSDDOMParser* fParser;
0777 XSDErrorReporter fXSDErrorReporter;
0778 XSDLocator* fLocator;
0779 MemoryManager* fMemoryManager;
0780 MemoryManager* fGrammarPoolMemoryManager;
0781 XSAnnotation* fAnnotation;
0782 GeneralAttributeCheck fAttributeCheck;
0783
0784 friend class GeneralAttributeCheck;
0785 friend class NamespaceScopeManager;
0786 };
0787
0788
0789
0790
0791
0792 inline const XMLCh* TraverseSchema::getPrefix(const XMLCh* const rawName) {
0793
0794 int colonIndex = XMLString::indexOf(rawName, chColon);
0795
0796 if (colonIndex == -1 || colonIndex == 0) {
0797 return XMLUni::fgZeroLenString;
0798 }
0799
0800 fBuffer.set(rawName, colonIndex);
0801
0802 return fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer()));
0803 }
0804
0805 inline const XMLCh* TraverseSchema::getLocalPart(const XMLCh* const rawName) {
0806
0807 int colonIndex = XMLString::indexOf(rawName, chColon);
0808 XMLSize_t rawNameLen = XMLString::stringLen(rawName);
0809
0810 if (XMLSize_t(colonIndex + 1) == rawNameLen) {
0811 return XMLUni::fgZeroLenString;
0812 }
0813
0814 if (colonIndex == -1) {
0815 fBuffer.set(rawName, rawNameLen);
0816 }
0817 else {
0818
0819 fBuffer.set(rawName + colonIndex + 1, rawNameLen - colonIndex - 1);
0820 }
0821
0822 return fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer()));
0823 }
0824
0825 inline void
0826 TraverseSchema::checkForEmptyTargetNamespace(const DOMElement* const elem) {
0827
0828 const XMLCh* targetNS = getElementAttValue(elem, SchemaSymbols::fgATT_TARGETNAMESPACE);
0829
0830 if (targetNS && !*targetNS) {
0831 reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidTargetNSValue);
0832 }
0833 }
0834
0835 inline bool TraverseSchema::isBaseFromAnotherSchema(const XMLCh* const baseURI)
0836 {
0837 if (!XMLString::equals(baseURI,fTargetNSURIString)
0838 && !XMLString::equals(baseURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA)
0839 && (baseURI && *baseURI)) {
0840
0841
0842 return true;
0843 }
0844
0845 return false;
0846 }
0847
0848 inline bool TraverseSchema::isAttrOrAttrGroup(const DOMElement* const elem) {
0849
0850 const XMLCh* elementName = elem->getLocalName();
0851
0852 if (XMLString::equals(elementName, SchemaSymbols::fgELT_ATTRIBUTE) ||
0853 XMLString::equals(elementName, SchemaSymbols::fgELT_ATTRIBUTEGROUP) ||
0854 XMLString::equals(elementName, SchemaSymbols::fgELT_ANYATTRIBUTE)) {
0855 return true;
0856 }
0857
0858 return false;
0859 }
0860
0861 inline const XMLCh* TraverseSchema::genAnonTypeName(const XMLCh* const prefix) {
0862
0863 XMLCh anonCountStr[16];
0864
0865 XMLString::sizeToText(fAnonXSTypeCount++, anonCountStr, 15, 10, fMemoryManager);
0866 fBuffer.set(prefix);
0867 fBuffer.append(anonCountStr);
0868
0869 return fStringPool->getValueForId(fStringPool->addOrFind(fBuffer.getRawBuffer()));
0870 }
0871
0872 inline void TraverseSchema::popCurrentTypeNameStack() {
0873
0874 XMLSize_t stackSize = fCurrentTypeNameStack->size();
0875
0876 if (stackSize != 0) {
0877 fCurrentTypeNameStack->removeElementAt(stackSize - 1);
0878 }
0879 }
0880
0881 inline void
0882 TraverseSchema::copyWildCardData(const SchemaAttDef* const srcWildCard,
0883 SchemaAttDef* const destWildCard) {
0884
0885 destWildCard->getAttName()->setURI(srcWildCard->getAttName()->getURI());
0886 destWildCard->setType(srcWildCard->getType());
0887 destWildCard->setDefaultType(srcWildCard->getDefaultType());
0888 }
0889
0890 inline void TraverseSchema::getRedefineNewTypeName(const XMLCh* const oldTypeName,
0891 const int redefineCounter,
0892 XMLBuffer& newTypeName) {
0893
0894 newTypeName.set(oldTypeName);
0895
0896 for (int i=0; i < redefineCounter; i++) {
0897 newTypeName.append(SchemaSymbols::fgRedefIdentifier);
0898 }
0899 }
0900
0901 inline bool TraverseSchema::isImportingNS(const int namespaceURI) {
0902
0903 if (!fImportedNSList)
0904 return false;
0905
0906 return (fImportedNSList->containsElement(namespaceURI));
0907 }
0908
0909 inline void TraverseSchema::addImportedNS(const int namespaceURI) {
0910
0911 if (!fImportedNSList) {
0912 fImportedNSList = new (fMemoryManager) ValueVectorOf<int>(4, fMemoryManager);
0913 }
0914
0915 if (!fImportedNSList->containsElement(namespaceURI))
0916 fImportedNSList->addElement(namespaceURI);
0917 }
0918
0919 XERCES_CPP_NAMESPACE_END
0920
0921 #endif
0922
0923
0924
0925