[2674] | 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: XercesXPath.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(XERCESXPATH_HPP) |
---|
| 23 | #define XERCESXPATH_HPP |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | // --------------------------------------------------------------------------- |
---|
| 27 | // Includes |
---|
| 28 | // --------------------------------------------------------------------------- |
---|
| 29 | #include <xercesc/util/QName.hpp> |
---|
| 30 | #include <xercesc/util/RefVectorOf.hpp> |
---|
| 31 | #include <xercesc/util/ValueVectorOf.hpp> |
---|
| 32 | |
---|
| 33 | #include <xercesc/internal/XSerializable.hpp> |
---|
| 34 | |
---|
| 35 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 36 | |
---|
| 37 | // --------------------------------------------------------------------------- |
---|
| 38 | // Forward Declarations |
---|
| 39 | // --------------------------------------------------------------------------- |
---|
| 40 | class XMLStringPool; |
---|
| 41 | class NamespaceScope; |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | class VALIDATORS_EXPORT XercesNodeTest : public XSerializable, public XMemory |
---|
| 45 | { |
---|
| 46 | public: |
---|
| 47 | // ----------------------------------------------------------------------- |
---|
| 48 | // Constants |
---|
| 49 | // ----------------------------------------------------------------------- |
---|
| 50 | enum { |
---|
| 51 | QNAME = 1, |
---|
| 52 | WILDCARD = 2, |
---|
| 53 | NODE = 3, |
---|
| 54 | NAMESPACE= 4, |
---|
| 55 | UNKNOWN |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | // ----------------------------------------------------------------------- |
---|
| 59 | // Constructors/Destructor |
---|
| 60 | // ----------------------------------------------------------------------- |
---|
| 61 | XercesNodeTest(const short type, |
---|
| 62 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 63 | XercesNodeTest(const QName* const qName); |
---|
| 64 | XercesNodeTest(const XMLCh* const prefix, const unsigned int uriId, |
---|
| 65 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 66 | XercesNodeTest(const XercesNodeTest& other); |
---|
| 67 | ~XercesNodeTest() { delete fName; } |
---|
| 68 | |
---|
| 69 | // ----------------------------------------------------------------------- |
---|
| 70 | // Operators |
---|
| 71 | // ----------------------------------------------------------------------- |
---|
| 72 | XercesNodeTest& operator= (const XercesNodeTest& other); |
---|
| 73 | bool operator== (const XercesNodeTest& other) const; |
---|
| 74 | bool operator!= (const XercesNodeTest& other) const; |
---|
| 75 | |
---|
| 76 | // ----------------------------------------------------------------------- |
---|
| 77 | // Getter methods |
---|
| 78 | // ----------------------------------------------------------------------- |
---|
| 79 | short getType() const { return fType; } |
---|
| 80 | QName* getName() const { return fName; } |
---|
| 81 | |
---|
| 82 | /*** |
---|
| 83 | * Support for Serialization/De-serialization |
---|
| 84 | ***/ |
---|
| 85 | DECL_XSERIALIZABLE(XercesNodeTest) |
---|
| 86 | |
---|
| 87 | XercesNodeTest(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 88 | |
---|
| 89 | private: |
---|
| 90 | // ----------------------------------------------------------------------- |
---|
| 91 | // Data members |
---|
| 92 | // ----------------------------------------------------------------------- |
---|
| 93 | short fType; |
---|
| 94 | QName* fName; |
---|
| 95 | }; |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * A location path step comprised of an axis and node test. |
---|
| 100 | */ |
---|
| 101 | class VALIDATORS_EXPORT XercesStep : public XSerializable, public XMemory |
---|
| 102 | { |
---|
| 103 | public: |
---|
| 104 | // ----------------------------------------------------------------------- |
---|
| 105 | // Constants |
---|
| 106 | // ----------------------------------------------------------------------- |
---|
| 107 | enum { // Axis type |
---|
| 108 | CHILD = 1, |
---|
| 109 | ATTRIBUTE = 2, |
---|
| 110 | SELF = 3, |
---|
| 111 | DESCENDANT = 4, |
---|
| 112 | UNKNOWN |
---|
| 113 | }; |
---|
| 114 | |
---|
| 115 | // ----------------------------------------------------------------------- |
---|
| 116 | // Constructors/Destructor |
---|
| 117 | // ----------------------------------------------------------------------- |
---|
| 118 | XercesStep(const unsigned short axisType, XercesNodeTest* const nodeTest); |
---|
| 119 | XercesStep(const XercesStep& other); |
---|
| 120 | ~XercesStep() { delete fNodeTest; } |
---|
| 121 | |
---|
| 122 | // ----------------------------------------------------------------------- |
---|
| 123 | // Operators |
---|
| 124 | // ----------------------------------------------------------------------- |
---|
| 125 | XercesStep& operator= (const XercesStep& other); |
---|
| 126 | bool operator== (const XercesStep& other) const; |
---|
| 127 | bool operator!= (const XercesStep& other) const; |
---|
| 128 | |
---|
| 129 | // ----------------------------------------------------------------------- |
---|
| 130 | // Getter methods |
---|
| 131 | // ----------------------------------------------------------------------- |
---|
| 132 | unsigned short getAxisType() const { return fAxisType; } |
---|
| 133 | XercesNodeTest* getNodeTest() const { return fNodeTest; } |
---|
| 134 | |
---|
| 135 | /*** |
---|
| 136 | * Support for Serialization/De-serialization |
---|
| 137 | ***/ |
---|
| 138 | DECL_XSERIALIZABLE(XercesStep) |
---|
| 139 | |
---|
| 140 | XercesStep(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 141 | |
---|
| 142 | private: |
---|
| 143 | // ----------------------------------------------------------------------- |
---|
| 144 | // Data members |
---|
| 145 | // ----------------------------------------------------------------------- |
---|
| 146 | unsigned short fAxisType; |
---|
| 147 | XercesNodeTest* fNodeTest; |
---|
| 148 | }; |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | /** |
---|
| 152 | * A location path representation for an XPath expression. |
---|
| 153 | */ |
---|
| 154 | class VALIDATORS_EXPORT XercesLocationPath : public XSerializable, public XMemory |
---|
| 155 | { |
---|
| 156 | public: |
---|
| 157 | // ----------------------------------------------------------------------- |
---|
| 158 | // Constructors/Destructor |
---|
| 159 | // ----------------------------------------------------------------------- |
---|
| 160 | XercesLocationPath(RefVectorOf<XercesStep>* const steps); |
---|
| 161 | ~XercesLocationPath() { delete fSteps; } |
---|
| 162 | |
---|
| 163 | // ----------------------------------------------------------------------- |
---|
| 164 | // Operators |
---|
| 165 | // ----------------------------------------------------------------------- |
---|
| 166 | bool operator== (const XercesLocationPath& other) const; |
---|
| 167 | bool operator!= (const XercesLocationPath& other) const; |
---|
| 168 | |
---|
| 169 | // ----------------------------------------------------------------------- |
---|
| 170 | // Access methods |
---|
| 171 | // ----------------------------------------------------------------------- |
---|
| 172 | unsigned int getStepSize() const; |
---|
| 173 | void addStep(XercesStep* const aStep); |
---|
| 174 | XercesStep* getStep(const unsigned int index) const; |
---|
| 175 | |
---|
| 176 | /*** |
---|
| 177 | * Support for Serialization/De-serialization |
---|
| 178 | ***/ |
---|
| 179 | DECL_XSERIALIZABLE(XercesLocationPath) |
---|
| 180 | |
---|
| 181 | XercesLocationPath(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 182 | |
---|
| 183 | private: |
---|
| 184 | // ----------------------------------------------------------------------- |
---|
| 185 | // Unimplemented contstructors and operators |
---|
| 186 | // ----------------------------------------------------------------------- |
---|
| 187 | XercesLocationPath(const XercesLocationPath& other); |
---|
| 188 | XercesLocationPath& operator= (const XercesLocationPath& other); |
---|
| 189 | |
---|
| 190 | // ----------------------------------------------------------------------- |
---|
| 191 | // Data members |
---|
| 192 | // ----------------------------------------------------------------------- |
---|
| 193 | RefVectorOf<XercesStep>* fSteps; |
---|
| 194 | }; |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | class VALIDATORS_EXPORT XercesXPath : public XSerializable, public XMemory |
---|
| 198 | { |
---|
| 199 | public: |
---|
| 200 | // ----------------------------------------------------------------------- |
---|
| 201 | // Constants |
---|
| 202 | // ----------------------------------------------------------------------- |
---|
| 203 | /** |
---|
| 204 | * [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' |
---|
| 205 | * | NameTest | NodeType | Operator | FunctionName |
---|
| 206 | * | AxisName | Literal | Number | VariableReference |
---|
| 207 | */ |
---|
| 208 | enum { |
---|
| 209 | EXPRTOKEN_OPEN_PAREN = 0, |
---|
| 210 | EXPRTOKEN_CLOSE_PAREN = 1, |
---|
| 211 | EXPRTOKEN_OPEN_BRACKET = 2, |
---|
| 212 | EXPRTOKEN_CLOSE_BRACKET = 3, |
---|
| 213 | EXPRTOKEN_PERIOD = 4, |
---|
| 214 | EXPRTOKEN_DOUBLE_PERIOD = 5, |
---|
| 215 | EXPRTOKEN_ATSIGN = 6, |
---|
| 216 | EXPRTOKEN_COMMA = 7, |
---|
| 217 | EXPRTOKEN_DOUBLE_COLON = 8, |
---|
| 218 | EXPRTOKEN_NAMETEST_ANY = 9, |
---|
| 219 | EXPRTOKEN_NAMETEST_NAMESPACE = 10, |
---|
| 220 | EXPRTOKEN_NAMETEST_QNAME = 11, |
---|
| 221 | EXPRTOKEN_NODETYPE_COMMENT = 12, |
---|
| 222 | EXPRTOKEN_NODETYPE_TEXT = 13, |
---|
| 223 | EXPRTOKEN_NODETYPE_PI = 14, |
---|
| 224 | EXPRTOKEN_NODETYPE_NODE = 15, |
---|
| 225 | EXPRTOKEN_OPERATOR_AND = 16, |
---|
| 226 | EXPRTOKEN_OPERATOR_OR = 17, |
---|
| 227 | EXPRTOKEN_OPERATOR_MOD = 18, |
---|
| 228 | EXPRTOKEN_OPERATOR_DIV = 19, |
---|
| 229 | EXPRTOKEN_OPERATOR_MULT = 20, |
---|
| 230 | EXPRTOKEN_OPERATOR_SLASH = 21, |
---|
| 231 | EXPRTOKEN_OPERATOR_DOUBLE_SLASH = 22, |
---|
| 232 | EXPRTOKEN_OPERATOR_UNION = 23, |
---|
| 233 | EXPRTOKEN_OPERATOR_PLUS = 24, |
---|
| 234 | EXPRTOKEN_OPERATOR_MINUS = 25, |
---|
| 235 | EXPRTOKEN_OPERATOR_EQUAL = 26, |
---|
| 236 | EXPRTOKEN_OPERATOR_NOT_EQUAL = 27, |
---|
| 237 | EXPRTOKEN_OPERATOR_LESS = 28, |
---|
| 238 | EXPRTOKEN_OPERATOR_LESS_EQUAL = 29, |
---|
| 239 | EXPRTOKEN_OPERATOR_GREATER = 30, |
---|
| 240 | EXPRTOKEN_OPERATOR_GREATER_EQUAL = 31, |
---|
| 241 | EXPRTOKEN_FUNCTION_NAME = 32, |
---|
| 242 | EXPRTOKEN_AXISNAME_ANCESTOR = 33, |
---|
| 243 | EXPRTOKEN_AXISNAME_ANCESTOR_OR_SELF = 34, |
---|
| 244 | EXPRTOKEN_AXISNAME_ATTRIBUTE = 35, |
---|
| 245 | EXPRTOKEN_AXISNAME_CHILD = 36, |
---|
| 246 | EXPRTOKEN_AXISNAME_DESCENDANT = 37, |
---|
| 247 | EXPRTOKEN_AXISNAME_DESCENDANT_OR_SELF = 38, |
---|
| 248 | EXPRTOKEN_AXISNAME_FOLLOWING = 39, |
---|
| 249 | EXPRTOKEN_AXISNAME_FOLLOWING_SIBLING = 40, |
---|
| 250 | EXPRTOKEN_AXISNAME_NAMESPACE = 41, |
---|
| 251 | EXPRTOKEN_AXISNAME_PARENT = 42, |
---|
| 252 | EXPRTOKEN_AXISNAME_PRECEDING = 43, |
---|
| 253 | EXPRTOKEN_AXISNAME_PRECEDING_SIBLING = 44, |
---|
| 254 | EXPRTOKEN_AXISNAME_SELF = 45, |
---|
| 255 | EXPRTOKEN_LITERAL = 46, |
---|
| 256 | EXPRTOKEN_NUMBER = 47, |
---|
| 257 | EXPRTOKEN_VARIABLE_REFERENCE = 48 |
---|
| 258 | }; |
---|
| 259 | |
---|
| 260 | // ----------------------------------------------------------------------- |
---|
| 261 | // Constructors/Destructor |
---|
| 262 | // ----------------------------------------------------------------------- |
---|
| 263 | XercesXPath(const XMLCh* const xpathExpr, |
---|
| 264 | XMLStringPool* const stringPool, |
---|
| 265 | NamespaceScope* const scopeContext, |
---|
| 266 | const unsigned int emptyNamespaceId, |
---|
| 267 | const bool isSelector = false, |
---|
| 268 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 269 | ~XercesXPath(); |
---|
| 270 | |
---|
| 271 | // ----------------------------------------------------------------------- |
---|
| 272 | // Operators |
---|
| 273 | // ----------------------------------------------------------------------- |
---|
| 274 | bool operator== (const XercesXPath& other) const; |
---|
| 275 | bool operator!= (const XercesXPath& other) const; |
---|
| 276 | |
---|
| 277 | // ----------------------------------------------------------------------- |
---|
| 278 | // Constructors/Destructor |
---|
| 279 | // ----------------------------------------------------------------------- |
---|
| 280 | RefVectorOf<XercesLocationPath>* getLocationPaths() const; |
---|
| 281 | |
---|
| 282 | /*** |
---|
| 283 | * Support for Serialization/De-serialization |
---|
| 284 | ***/ |
---|
| 285 | DECL_XSERIALIZABLE(XercesXPath) |
---|
| 286 | |
---|
| 287 | XercesXPath(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 288 | |
---|
| 289 | XMLCh* getExpression(); |
---|
| 290 | |
---|
| 291 | private: |
---|
| 292 | // ----------------------------------------------------------------------- |
---|
| 293 | // Unimplemented contstructors and operators |
---|
| 294 | // ----------------------------------------------------------------------- |
---|
| 295 | XercesXPath(const XercesXPath& other); |
---|
| 296 | XercesXPath& operator= (const XercesXPath& other); |
---|
| 297 | |
---|
| 298 | // ----------------------------------------------------------------------- |
---|
| 299 | // Helper methods |
---|
| 300 | // ----------------------------------------------------------------------- |
---|
| 301 | void cleanUp(); |
---|
| 302 | void checkForSelectedAttributes(); |
---|
| 303 | void parseExpression(XMLStringPool* const stringPool, |
---|
| 304 | NamespaceScope* const scopeContext); |
---|
| 305 | |
---|
| 306 | // ----------------------------------------------------------------------- |
---|
| 307 | // Data members |
---|
| 308 | // ----------------------------------------------------------------------- |
---|
| 309 | unsigned int fEmptyNamespaceId; |
---|
| 310 | XMLCh* fExpression; |
---|
| 311 | RefVectorOf<XercesLocationPath>* fLocationPaths; |
---|
| 312 | MemoryManager* fMemoryManager; |
---|
| 313 | }; |
---|
| 314 | |
---|
| 315 | |
---|
| 316 | class VALIDATORS_EXPORT XPathScanner : public XMemory |
---|
| 317 | { |
---|
| 318 | public: |
---|
| 319 | // ----------------------------------------------------------------------- |
---|
| 320 | // Constants |
---|
| 321 | // ----------------------------------------------------------------------- |
---|
| 322 | enum { |
---|
| 323 | CHARTYPE_INVALID = 0, // invalid XML character |
---|
| 324 | CHARTYPE_OTHER = 1, // not special - one of "#%&;?\^`{}~" or DEL |
---|
| 325 | CHARTYPE_WHITESPACE = 2, // one of "\t\n\r " (0x09, 0x0A, 0x0D, 0x20) |
---|
| 326 | CHARTYPE_EXCLAMATION = 3, // '!' (0x21) |
---|
| 327 | CHARTYPE_QUOTE = 4, // '\"' or '\'' (0x22 and 0x27) |
---|
| 328 | CHARTYPE_DOLLAR = 5, // '$' (0x24) |
---|
| 329 | CHARTYPE_OPEN_PAREN = 6, // '(' (0x28) |
---|
| 330 | CHARTYPE_CLOSE_PAREN = 7, // ')' (0x29) |
---|
| 331 | CHARTYPE_STAR = 8, // '*' (0x2A) |
---|
| 332 | CHARTYPE_PLUS = 9, // '+' (0x2B) |
---|
| 333 | CHARTYPE_COMMA = 10, // ',' (0x2C) |
---|
| 334 | CHARTYPE_MINUS = 11, // '-' (0x2D) |
---|
| 335 | CHARTYPE_PERIOD = 12, // '.' (0x2E) |
---|
| 336 | CHARTYPE_SLASH = 13, // '/' (0x2F) |
---|
| 337 | CHARTYPE_DIGIT = 14, // '0'-'9' (0x30 to 0x39) |
---|
| 338 | CHARTYPE_COLON = 15, // ':' (0x3A) |
---|
| 339 | CHARTYPE_LESS = 16, // '<' (0x3C) |
---|
| 340 | CHARTYPE_EQUAL = 17, // '=' (0x3D) |
---|
| 341 | CHARTYPE_GREATER = 18, // '>' (0x3E) |
---|
| 342 | CHARTYPE_ATSIGN = 19, // '@' (0x40) |
---|
| 343 | CHARTYPE_LETTER = 20, // 'A'-'Z' or 'a'-'z' (0x41 to 0x5A and 0x61 to 0x7A) |
---|
| 344 | CHARTYPE_OPEN_BRACKET = 21, // '[' (0x5B) |
---|
| 345 | CHARTYPE_CLOSE_BRACKET = 22, // ']' (0x5D) |
---|
| 346 | CHARTYPE_UNDERSCORE = 23, // '_' (0x5F) |
---|
| 347 | CHARTYPE_UNION = 24, // '|' (0x7C) |
---|
| 348 | CHARTYPE_NONASCII = 25 // Non-ASCII Unicode codepoint (>= 0x80) |
---|
| 349 | }; |
---|
| 350 | |
---|
| 351 | // ----------------------------------------------------------------------- |
---|
| 352 | // Constructors/Destructor |
---|
| 353 | // ----------------------------------------------------------------------- |
---|
| 354 | XPathScanner(XMLStringPool* const stringPool); |
---|
| 355 | virtual ~XPathScanner() {} |
---|
| 356 | |
---|
| 357 | // ----------------------------------------------------------------------- |
---|
| 358 | // Scan methods |
---|
| 359 | // ----------------------------------------------------------------------- |
---|
| 360 | bool scanExpression(const XMLCh* const data, int currentOffset, |
---|
| 361 | const int endOffset, ValueVectorOf<int>* const tokens); |
---|
| 362 | |
---|
| 363 | protected: |
---|
| 364 | // ----------------------------------------------------------------------- |
---|
| 365 | // Helper methods |
---|
| 366 | // ----------------------------------------------------------------------- |
---|
| 367 | /** |
---|
| 368 | * This method adds the specified token to the token list. By default, |
---|
| 369 | * this method allows all tokens. However, subclasses can can override |
---|
| 370 | * this method in order to disallow certain tokens from being used in the |
---|
| 371 | * scanned XPath expression. This is a convenient way of allowing only |
---|
| 372 | * a subset of XPath. |
---|
| 373 | */ |
---|
| 374 | virtual void addToken(ValueVectorOf<int>* const tokens, const int aToken); |
---|
| 375 | |
---|
| 376 | private: |
---|
| 377 | // ----------------------------------------------------------------------- |
---|
| 378 | // Unimplemented contstructors and operators |
---|
| 379 | // ----------------------------------------------------------------------- |
---|
| 380 | XPathScanner(const XPathScanner& other); |
---|
| 381 | XPathScanner& operator= (const XPathScanner& other); |
---|
| 382 | |
---|
| 383 | // ----------------------------------------------------------------------- |
---|
| 384 | // Helper methods |
---|
| 385 | // ----------------------------------------------------------------------- |
---|
| 386 | void init(); |
---|
| 387 | |
---|
| 388 | // ----------------------------------------------------------------------- |
---|
| 389 | // Scan methods |
---|
| 390 | // ----------------------------------------------------------------------- |
---|
| 391 | int scanNCName(const XMLCh* const data, const int endOffset, |
---|
| 392 | int currentOffset); |
---|
| 393 | int scanNumber(const XMLCh* const data, const int endOffset, |
---|
| 394 | int currentOffset, ValueVectorOf<int>* const tokens); |
---|
| 395 | |
---|
| 396 | // ----------------------------------------------------------------------- |
---|
| 397 | // Data members |
---|
| 398 | // ----------------------------------------------------------------------- |
---|
| 399 | int fAndSymbol; |
---|
| 400 | int fOrSymbol; |
---|
| 401 | int fModSymbol; |
---|
| 402 | int fDivSymbol; |
---|
| 403 | int fCommentSymbol; |
---|
| 404 | int fTextSymbol; |
---|
| 405 | int fPISymbol; |
---|
| 406 | int fNodeSymbol; |
---|
| 407 | int fAncestorSymbol; |
---|
| 408 | int fAncestorOrSelfSymbol; |
---|
| 409 | int fAttributeSymbol; |
---|
| 410 | int fChildSymbol; |
---|
| 411 | int fDescendantSymbol; |
---|
| 412 | int fDescendantOrSelfSymbol; |
---|
| 413 | int fFollowingSymbol; |
---|
| 414 | int fFollowingSiblingSymbol; |
---|
| 415 | int fNamespaceSymbol; |
---|
| 416 | int fParentSymbol; |
---|
| 417 | int fPrecedingSymbol; |
---|
| 418 | int fPrecedingSiblingSymbol; |
---|
| 419 | int fSelfSymbol; |
---|
| 420 | XMLStringPool* fStringPool; |
---|
| 421 | |
---|
| 422 | static const XMLByte fASCIICharMap[128]; |
---|
| 423 | }; |
---|
| 424 | |
---|
| 425 | |
---|
| 426 | class VALIDATORS_EXPORT XPathScannerForSchema: public XPathScanner |
---|
| 427 | { |
---|
| 428 | public: |
---|
| 429 | // ----------------------------------------------------------------------- |
---|
| 430 | // Constructors/Destructor |
---|
| 431 | // ----------------------------------------------------------------------- |
---|
| 432 | XPathScannerForSchema(XMLStringPool* const stringPool); |
---|
| 433 | ~XPathScannerForSchema() {} |
---|
| 434 | |
---|
| 435 | protected: |
---|
| 436 | // ----------------------------------------------------------------------- |
---|
| 437 | // Helper methods |
---|
| 438 | // ----------------------------------------------------------------------- |
---|
| 439 | void addToken(ValueVectorOf<int>* const tokens, const int aToken); |
---|
| 440 | |
---|
| 441 | private: |
---|
| 442 | // ----------------------------------------------------------------------- |
---|
| 443 | // Unimplemented contstructors and operators |
---|
| 444 | // ----------------------------------------------------------------------- |
---|
| 445 | XPathScannerForSchema(const XPathScannerForSchema& other); |
---|
| 446 | XPathScannerForSchema& operator= (const XPathScannerForSchema& other); |
---|
| 447 | }; |
---|
| 448 | |
---|
| 449 | // --------------------------------------------------------------------------- |
---|
| 450 | // XercesLocationPath: Access methods |
---|
| 451 | // --------------------------------------------------------------------------- |
---|
| 452 | inline unsigned int XercesLocationPath::getStepSize() const { |
---|
| 453 | |
---|
| 454 | if (fSteps) |
---|
| 455 | return fSteps->size(); |
---|
| 456 | |
---|
| 457 | return 0; |
---|
| 458 | } |
---|
| 459 | |
---|
| 460 | inline void XercesLocationPath::addStep(XercesStep* const aStep) { |
---|
| 461 | |
---|
| 462 | fSteps->addElement(aStep); |
---|
| 463 | } |
---|
| 464 | |
---|
| 465 | inline XercesStep* XercesLocationPath::getStep(const unsigned int index) const { |
---|
| 466 | |
---|
| 467 | if (fSteps) |
---|
| 468 | return fSteps->elementAt(index); |
---|
| 469 | |
---|
| 470 | return 0; |
---|
| 471 | } |
---|
| 472 | |
---|
| 473 | // --------------------------------------------------------------------------- |
---|
| 474 | // XercesScanner: Helper methods |
---|
| 475 | // --------------------------------------------------------------------------- |
---|
| 476 | inline void XPathScanner::addToken(ValueVectorOf<int>* const tokens, |
---|
| 477 | const int aToken) { |
---|
| 478 | tokens->addElement(aToken); |
---|
| 479 | } |
---|
| 480 | |
---|
| 481 | |
---|
| 482 | // --------------------------------------------------------------------------- |
---|
| 483 | // XercesXPath: Getter methods |
---|
| 484 | // --------------------------------------------------------------------------- |
---|
| 485 | inline RefVectorOf<XercesLocationPath>* XercesXPath::getLocationPaths() const { |
---|
| 486 | |
---|
| 487 | return fLocationPaths; |
---|
| 488 | } |
---|
| 489 | |
---|
| 490 | inline XMLCh* XercesXPath::getExpression() { |
---|
| 491 | return fExpression; |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | XERCES_CPP_NAMESPACE_END |
---|
| 495 | |
---|
| 496 | #endif |
---|
| 497 | |
---|
| 498 | /** |
---|
| 499 | * End of file XercesPath.hpp |
---|
| 500 | */ |
---|
| 501 | |
---|