File indexing completed on 2025-01-18 10:15:19
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_GENERALATTRIBUTECHECK_HPP)
0023 #define XERCESC_INCLUDE_GUARD_GENERALATTRIBUTECHECK_HPP
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include <xercesc/util/RefHashTableOf.hpp>
0034 #include <xercesc/util/ValueHashTableOf.hpp>
0035 #include <xercesc/validators/datatype/IDDatatypeValidator.hpp>
0036 #include <xercesc/framework/ValidationContext.hpp>
0037
0038 XERCES_CPP_NAMESPACE_BEGIN
0039
0040
0041
0042
0043 class TraverseSchema;
0044 class DOMElement;
0045 class DOMNode;
0046
0047 class VALIDATORS_EXPORT GeneralAttributeCheck : public XMemory
0048 {
0049 public:
0050
0051
0052
0053
0054 enum
0055 {
0056 E_All,
0057 E_Annotation,
0058 E_Any,
0059 E_AnyAttribute,
0060 E_Appinfo,
0061 E_AttributeGlobal,
0062 E_AttributeLocal,
0063 E_AttributeRef,
0064 E_AttributeGroupGlobal,
0065 E_AttributeGroupRef,
0066 E_Choice,
0067 E_ComplexContent,
0068 E_ComplexTypeGlobal,
0069 E_ComplexTypeLocal,
0070 E_Documentation,
0071 E_ElementGlobal,
0072 E_ElementLocal,
0073 E_ElementRef,
0074 E_Enumeration,
0075 E_Extension,
0076 E_Field,
0077 E_FractionDigits,
0078 E_GroupGlobal,
0079 E_GroupRef,
0080 E_Import,
0081 E_Include,
0082 E_Key,
0083 E_KeyRef,
0084 E_Length,
0085 E_List,
0086 E_MaxExclusive,
0087 E_MaxInclusive,
0088 E_MaxLength,
0089 E_MinExclusive,
0090 E_MinInclusive,
0091 E_MinLength,
0092 E_Notation,
0093 E_Pattern,
0094 E_Redefine,
0095 E_Restriction,
0096 E_Schema,
0097 E_Selector,
0098 E_Sequence,
0099 E_SimpleContent,
0100 E_SimpleTypeGlobal,
0101 E_SimpleTypeLocal,
0102 E_TotalDigits,
0103 E_Union,
0104 E_Unique,
0105 E_WhiteSpace,
0106
0107 E_Count,
0108 E_Invalid = -1
0109 };
0110
0111
0112 enum
0113 {
0114 A_Abstract,
0115 A_AttributeFormDefault,
0116 A_Base,
0117 A_Block,
0118 A_BlockDefault,
0119 A_Default,
0120 A_ElementFormDefault,
0121 A_Final,
0122 A_FinalDefault,
0123 A_Fixed,
0124 A_Form,
0125 A_ID,
0126 A_ItemType,
0127 A_MaxOccurs,
0128 A_MemberTypes,
0129 A_MinOccurs,
0130 A_Mixed,
0131 A_Name,
0132 A_Namespace,
0133 A_Nillable,
0134 A_ProcessContents,
0135 A_Public,
0136 A_Ref,
0137 A_Refer,
0138 A_SchemaLocation,
0139 A_Source,
0140 A_SubstitutionGroup,
0141 A_System,
0142 A_TargetNamespace,
0143 A_Type,
0144 A_Use,
0145 A_Value,
0146 A_Version,
0147 A_XPath,
0148
0149 A_Count,
0150 A_Invalid = -1
0151 };
0152
0153
0154 enum {
0155
0156 DV_String = 0,
0157 DV_AnyURI = 4,
0158 DV_NonNegInt = 8,
0159 DV_Boolean = 16,
0160 DV_ID = 32,
0161 DV_Form = 64,
0162 DV_MaxOccurs = 128,
0163 DV_MaxOccurs1 = 256,
0164 DV_MinOccurs1 = 512,
0165 DV_ProcessContents = 1024,
0166 DV_Use = 2048,
0167 DV_WhiteSpace = 4096,
0168
0169 DV_Mask = (DV_AnyURI | DV_NonNegInt | DV_Boolean | DV_ID | DV_Form |
0170 DV_MaxOccurs | DV_MaxOccurs1 | DV_MinOccurs1 |
0171 DV_ProcessContents | DV_Use | DV_WhiteSpace)
0172 };
0173
0174
0175 #if defined(NEED_TO_GEN_ELEM_ATT_MAP_TABLE)
0176 static void initCharFlagTable();
0177 #endif
0178
0179
0180
0181
0182 GeneralAttributeCheck(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0183 ~GeneralAttributeCheck();
0184
0185
0186
0187
0188 unsigned short getFacetId(const XMLCh* const facetName, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0189
0190
0191
0192
0193 void checkAttributes(const DOMElement* const elem,
0194 const unsigned short elemContext,
0195 TraverseSchema* const schema,
0196 const bool isTopLevel = false,
0197 ValueVectorOf<DOMNode*>* const nonXSAttList = 0);
0198
0199 private:
0200
0201
0202
0203 GeneralAttributeCheck(const GeneralAttributeCheck&);
0204 GeneralAttributeCheck& operator=(const GeneralAttributeCheck&);
0205
0206
0207
0208
0209 void validate(const DOMElement* const elem, const XMLCh* const attName, const XMLCh* const attValue,
0210 const short dvIndex, TraverseSchema* const schema);
0211
0212
0213
0214
0215
0216 enum {
0217 Att_Required = 1,
0218 Att_Optional = 2,
0219 Att_Mask = 3
0220 };
0221
0222
0223
0224
0225 static ValueHashTableOf<unsigned short>* fAttMap;
0226 static ValueHashTableOf<unsigned short>* fFacetsMap;
0227 static DatatypeValidator* fNonNegIntDV;
0228 static DatatypeValidator* fBooleanDV;
0229 static DatatypeValidator* fAnyURIDV;
0230 static unsigned short fgElemAttTable[E_Count][A_Count];
0231 static const XMLCh* fAttNames[A_Count];
0232 MemoryManager* fMemoryManager;
0233 IDDatatypeValidator fIDValidator;
0234
0235 private:
0236 static void initialize();
0237
0238 friend class XMLInitializer;
0239 };
0240
0241
0242
0243
0244
0245 inline unsigned short
0246 GeneralAttributeCheck::getFacetId(const XMLCh* const facetName, MemoryManager* const manager) {
0247
0248 return fFacetsMap->get(facetName, manager);
0249 }
0250
0251 XERCES_CPP_NAMESPACE_END
0252
0253 #endif
0254
0255
0256
0257
0258