[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: XMLAttr.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(XMLATTR_HPP) |
---|
| 23 | #define XMLATTR_HPP |
---|
| 24 | |
---|
| 25 | #include <xercesc/util/PlatformUtils.hpp> |
---|
| 26 | #include <xercesc/util/QName.hpp> |
---|
| 27 | #include <xercesc/framework/XMLAttDef.hpp> |
---|
| 28 | #include <xercesc/validators/datatype/DatatypeValidator.hpp> |
---|
| 29 | |
---|
| 30 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 31 | |
---|
| 32 | /** |
---|
| 33 | * This class defines the information about an attribute that will come out |
---|
| 34 | * of the scanner during parsing. This information does not depend upon the |
---|
| 35 | * type of validator because it is not tied to any scheme/DTD type info. Its |
---|
| 36 | * just the raw XML 1.0 information that will be reported about an attribute |
---|
| 37 | * in the startElement() callback method of the XMLDocumentHandler class. |
---|
| 38 | * Hence it is not intended to be extended or derived from. Its designed to |
---|
| 39 | * be used as is. |
---|
| 40 | * |
---|
| 41 | * The 'specified' field of this class indicates whether the attribute was |
---|
| 42 | * actually present or whether it was faulted in because it had a fixed or |
---|
| 43 | * default value. |
---|
| 44 | * |
---|
| 45 | * The code receiving this information can ask its validator for more info |
---|
| 46 | * about the attribute, i.e. get its declaration from the DTD/Schema info. |
---|
| 47 | * |
---|
| 48 | * Because of the heavy use (and reuse) of instances of this class, and the |
---|
| 49 | * number of string members it has, this class takes pains to not reallocate |
---|
| 50 | * string members unless it has to. It keeps up with how long each buffer |
---|
| 51 | * is and only reallocates if the new value won't fit. |
---|
| 52 | */ |
---|
| 53 | class XMLPARSER_EXPORT XMLAttr : public XMemory |
---|
| 54 | { |
---|
| 55 | public: |
---|
| 56 | // ----------------------------------------------------------------------- |
---|
| 57 | // Constructors and Destructor |
---|
| 58 | // ----------------------------------------------------------------------- |
---|
| 59 | /** @name Constructors */ |
---|
| 60 | //@{ |
---|
| 61 | |
---|
| 62 | /** |
---|
| 63 | * The default constructor just setsup an empty attribute to be filled |
---|
| 64 | * in the later. Though the initial state is a reasonable one, it is |
---|
| 65 | * not documented because it should not be depended on. |
---|
| 66 | * |
---|
| 67 | * @param manager The configurable memory manager |
---|
| 68 | */ |
---|
| 69 | XMLAttr(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 70 | |
---|
| 71 | /** |
---|
| 72 | * This is the primary constructor which takes all of the information |
---|
| 73 | * required to construct a complete attribute object. |
---|
| 74 | * |
---|
| 75 | * @param uriId The id into the validator's URI pool of the URI |
---|
| 76 | * that the prefix mapped to. Only used if namespaces |
---|
| 77 | * are enabled/supported. |
---|
| 78 | * |
---|
| 79 | * @param attrName The base name of the attribute, i.e. the part |
---|
| 80 | * after any prefix. |
---|
| 81 | * |
---|
| 82 | * @param attrPrefix The prefix, if any, of this attribute's name. If |
---|
| 83 | * this is empty, then uriID is meaningless as well. |
---|
| 84 | * |
---|
| 85 | * @param attrValue The value string of the attribute, which should |
---|
| 86 | * be fully normalized by XML rules! |
---|
| 87 | * |
---|
| 88 | * @param type The type of the attribute. This will indicate |
---|
| 89 | * the type of normalization done and constrains |
---|
| 90 | * the value content. Make sure that the value |
---|
| 91 | * set meets the constraints! |
---|
| 92 | * |
---|
| 93 | * @param specified Indicates whether the attribute was explicitly |
---|
| 94 | * specified or not. If not, then it was faulted |
---|
| 95 | * in from a FIXED or DEFAULT value. |
---|
| 96 | * |
---|
| 97 | * @param manager The configurable memory manager |
---|
| 98 | * @param datatypeValidator type used to validate the attribute, |
---|
| 99 | * if it was validated by an XML Schema |
---|
| 100 | * @param isSchema true if and only if this attribute was validated |
---|
| 101 | * by an XML Schema |
---|
| 102 | */ |
---|
| 103 | XMLAttr |
---|
| 104 | ( |
---|
| 105 | const unsigned int uriId |
---|
| 106 | , const XMLCh* const attrName |
---|
| 107 | , const XMLCh* const attrPrefix |
---|
| 108 | , const XMLCh* const attrValue |
---|
| 109 | , const XMLAttDef::AttTypes type = XMLAttDef::CData |
---|
| 110 | , const bool specified = true |
---|
| 111 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 112 | , DatatypeValidator * datatypeValidator = 0 |
---|
| 113 | , const bool isSchema = false |
---|
| 114 | ); |
---|
| 115 | |
---|
| 116 | /** |
---|
| 117 | * This is the primary constructor which takes all of the information |
---|
| 118 | * required to construct a complete attribute object. |
---|
| 119 | * |
---|
| 120 | * @param uriId The id into the validator's URI pool of the URI |
---|
| 121 | * that the prefix mapped to. Only used if namespaces |
---|
| 122 | * are enabled/supported. |
---|
| 123 | * |
---|
| 124 | * @param rawName The raw name of the attribute. |
---|
| 125 | * |
---|
| 126 | * @param attrValue The value string of the attribute, which should |
---|
| 127 | * be fully normalized by XML rules! |
---|
| 128 | * |
---|
| 129 | * @param type The type of the attribute. This will indicate |
---|
| 130 | * the type of normalization done and constrains |
---|
| 131 | * the value content. Make sure that the value |
---|
| 132 | * set meets the constraints! |
---|
| 133 | * |
---|
| 134 | * @param specified Indicates whether the attribute was explicitly |
---|
| 135 | * specified or not. If not, then it was faulted |
---|
| 136 | * in from a FIXED or DEFAULT value. |
---|
| 137 | * |
---|
| 138 | * @param manager The configurable memory manager |
---|
| 139 | * @param datatypeValidator type used to validate the attribute, |
---|
| 140 | * if it was validated by an XML Schema |
---|
| 141 | * @param isSchema true if and only if this attribute was validated |
---|
| 142 | * by an XML Schema |
---|
| 143 | */ |
---|
| 144 | XMLAttr |
---|
| 145 | ( |
---|
| 146 | const unsigned int uriId |
---|
| 147 | , const XMLCh* const rawName |
---|
| 148 | , const XMLCh* const attrValue |
---|
| 149 | , const XMLAttDef::AttTypes type = XMLAttDef::CData |
---|
| 150 | , const bool specified = true |
---|
| 151 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 152 | , DatatypeValidator * datatypeValidator = 0 |
---|
| 153 | , const bool isSchema = false |
---|
| 154 | ); |
---|
| 155 | |
---|
| 156 | //@} |
---|
| 157 | |
---|
| 158 | /** @name Destructor */ |
---|
| 159 | //@{ |
---|
| 160 | ~XMLAttr(); |
---|
| 161 | //@} |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | // ----------------------------------------------------------------------- |
---|
| 165 | // Getter methods |
---|
| 166 | // ----------------------------------------------------------------------- |
---|
| 167 | |
---|
| 168 | /** @name Getter methods */ |
---|
| 169 | //@{ |
---|
| 170 | |
---|
| 171 | /** |
---|
| 172 | * This methode returns the attribute name in a QName format. |
---|
| 173 | */ |
---|
| 174 | QName* getAttName() const; |
---|
| 175 | |
---|
| 176 | /** |
---|
| 177 | * This method gets a const pointer tot he name of the attribute. The |
---|
| 178 | * form of this name is defined by the validator in use. |
---|
| 179 | */ |
---|
| 180 | const XMLCh* getName() const; |
---|
| 181 | |
---|
| 182 | /** |
---|
| 183 | * This method will get a const pointer to the prefix string of this |
---|
| 184 | * attribute. Since prefixes are optional, it may be zero. |
---|
| 185 | */ |
---|
| 186 | const XMLCh* getPrefix() const; |
---|
| 187 | |
---|
| 188 | /** |
---|
| 189 | * This method will get the QName of this attribute, which will be the |
---|
| 190 | * prefix if any, then a colon, then the base name. If there was no |
---|
| 191 | * prefix, its the same as the getName() method. |
---|
| 192 | */ |
---|
| 193 | const XMLCh* getQName() const; |
---|
| 194 | |
---|
| 195 | /** |
---|
| 196 | * This method will get the specified flag, which indicates whether |
---|
| 197 | * the attribute was explicitly specified or just faulted in. |
---|
| 198 | */ |
---|
| 199 | bool getSpecified() const; |
---|
| 200 | |
---|
| 201 | /** |
---|
| 202 | * This method will get the type of the attribute. The available types |
---|
| 203 | * are defined by the XML specification. |
---|
| 204 | */ |
---|
| 205 | XMLAttDef::AttTypes getType() const; |
---|
| 206 | |
---|
| 207 | /** |
---|
| 208 | * This method will get the value of the attribute. The value can be |
---|
| 209 | * be an empty string, but never null if the object is correctly |
---|
| 210 | * set up. |
---|
| 211 | */ |
---|
| 212 | const XMLCh* getValue() const; |
---|
| 213 | |
---|
| 214 | /** |
---|
| 215 | * This method will get the id of the URI that this attribute's prefix |
---|
| 216 | * mapped to. If namespaces are not on, then its value is meaningless. |
---|
| 217 | */ |
---|
| 218 | unsigned int getURIId() const; |
---|
| 219 | |
---|
| 220 | /** |
---|
| 221 | * @return the uri part of DOM Level 3 TypeInfo |
---|
| 222 | * @deprecated |
---|
| 223 | */ |
---|
| 224 | const XMLCh* getValidatingTypeURI() const; |
---|
| 225 | |
---|
| 226 | /** |
---|
| 227 | * @return the name part of DOM Level 3 TypeInfo |
---|
| 228 | * @deprecated |
---|
| 229 | */ |
---|
| 230 | const XMLCh* getValidatingTypeName() const; |
---|
| 231 | |
---|
| 232 | //@} |
---|
| 233 | |
---|
| 234 | |
---|
| 235 | // ----------------------------------------------------------------------- |
---|
| 236 | // Setter methods |
---|
| 237 | // ----------------------------------------------------------------------- |
---|
| 238 | |
---|
| 239 | /** @name Setter methods */ |
---|
| 240 | //@{ |
---|
| 241 | |
---|
| 242 | /** |
---|
| 243 | * This method is called to set up a default constructed object after |
---|
| 244 | * the fact, or to reuse a previously used object. |
---|
| 245 | * |
---|
| 246 | * @param uriId The id into the validator's URI pool of the URI |
---|
| 247 | * that the prefix mapped to. Only used if namespaces |
---|
| 248 | * are enabled/supported. |
---|
| 249 | * |
---|
| 250 | * @param attrName The base name of the attribute, i.e. the part |
---|
| 251 | * after any prefix. |
---|
| 252 | * |
---|
| 253 | * @param attrPrefix The prefix, if any, of this attribute's name. If |
---|
| 254 | * this is empty, then uriID is meaningless as well. |
---|
| 255 | * |
---|
| 256 | * @param attrValue The value string of the attribute, which should |
---|
| 257 | * be fully normalized by XML rules according to the |
---|
| 258 | * attribute type. |
---|
| 259 | * |
---|
| 260 | * @param type The type of the attribute. This will indicate |
---|
| 261 | * the type of normalization done and constrains |
---|
| 262 | * the value content. Make sure that the value |
---|
| 263 | * set meets the constraints! |
---|
| 264 | * @param datatypeValidator type used to validate the attribute, |
---|
| 265 | * if it was validated by an XML Schema |
---|
| 266 | * @param isSchema true if and only if this attribute was validated |
---|
| 267 | * by an XML Schema |
---|
| 268 | * |
---|
| 269 | */ |
---|
| 270 | void set |
---|
| 271 | ( |
---|
| 272 | const unsigned int uriId |
---|
| 273 | , const XMLCh* const attrName |
---|
| 274 | , const XMLCh* const attrPrefix |
---|
| 275 | , const XMLCh* const attrValue |
---|
| 276 | , const XMLAttDef::AttTypes type = XMLAttDef::CData |
---|
| 277 | , DatatypeValidator * datatypeValidator = 0 |
---|
| 278 | , const bool isSchema = false |
---|
| 279 | ); |
---|
| 280 | |
---|
| 281 | /** |
---|
| 282 | * This method is called to set up a default constructed object after |
---|
| 283 | * the fact, or to reuse a previously used object. |
---|
| 284 | * |
---|
| 285 | * @param uriId The id into the validator's URI pool of the URI |
---|
| 286 | * that the prefix mapped to. Only used if namespaces |
---|
| 287 | * are enabled/supported. |
---|
| 288 | * |
---|
| 289 | * @param attrRawName The raw name of the attribute. |
---|
| 290 | * |
---|
| 291 | * @param attrValue The value string of the attribute, which should |
---|
| 292 | * be fully normalized by XML rules according to the |
---|
| 293 | * attribute type. |
---|
| 294 | * |
---|
| 295 | * @param type The type of the attribute. This will indicate |
---|
| 296 | * the type of normalization done and constrains |
---|
| 297 | * the value content. Make sure that the value |
---|
| 298 | * set meets the constraints! |
---|
| 299 | * @param datatypeValidator type used to validate the attribute, |
---|
| 300 | * if it was validated by an XML Schema |
---|
| 301 | * @param isSchema true if and only if this attribute was validated |
---|
| 302 | * by an XML Schema |
---|
| 303 | */ |
---|
| 304 | void set |
---|
| 305 | ( |
---|
| 306 | const unsigned int uriId |
---|
| 307 | , const XMLCh* const attrRawName |
---|
| 308 | , const XMLCh* const attrValue |
---|
| 309 | , const XMLAttDef::AttTypes type = XMLAttDef::CData |
---|
| 310 | , DatatypeValidator * datatypeValidator = 0 |
---|
| 311 | , const bool isSchema = false |
---|
| 312 | ); |
---|
| 313 | |
---|
| 314 | /** |
---|
| 315 | * This method will update just the name related fields of the |
---|
| 316 | * attribute object. The other fields are left as is. |
---|
| 317 | * |
---|
| 318 | * @param uriId The id into the validator's URI pool of the URI |
---|
| 319 | * that the prefix mapped to. Only used if namespaces |
---|
| 320 | * are enabled/supported. |
---|
| 321 | * |
---|
| 322 | * @param attrName The base name of the attribute, i.e. the part |
---|
| 323 | * after any prefix. |
---|
| 324 | * |
---|
| 325 | * @param attrPrefix The prefix, if any, of this attribute's name. If |
---|
| 326 | * this is empty, then uriID is meaningless as well. |
---|
| 327 | */ |
---|
| 328 | void setName |
---|
| 329 | ( |
---|
| 330 | const unsigned int uriId |
---|
| 331 | , const XMLCh* const attrName |
---|
| 332 | , const XMLCh* const attrPrefix |
---|
| 333 | ); |
---|
| 334 | |
---|
| 335 | /** |
---|
| 336 | * This method will update the specified state of the object. |
---|
| 337 | * |
---|
| 338 | * @param newValue Indicates whether the attribute was explicitly |
---|
| 339 | * specified or not. If not, then it was faulted |
---|
| 340 | * in from a FIXED or DEFAULT value. |
---|
| 341 | */ |
---|
| 342 | void setSpecified(const bool newValue); |
---|
| 343 | |
---|
| 344 | /** |
---|
| 345 | * This method will update the attribute type of the object. |
---|
| 346 | * |
---|
| 347 | * @param newType The type of the attribute. This will indicate |
---|
| 348 | * the type of normalization done and constrains |
---|
| 349 | * the value content. Make sure that the value |
---|
| 350 | * set meets the constraints! |
---|
| 351 | */ |
---|
| 352 | void setType(const XMLAttDef::AttTypes newType); |
---|
| 353 | |
---|
| 354 | /** |
---|
| 355 | * This method will update the value field of the attribute. |
---|
| 356 | * |
---|
| 357 | * @param newValue The value string of the attribute, which should |
---|
| 358 | * be fully normalized by XML rules according to the |
---|
| 359 | * attribute type. |
---|
| 360 | */ |
---|
| 361 | void setValue(const XMLCh* const newValue); |
---|
| 362 | |
---|
| 363 | /** |
---|
| 364 | * This method will set the URI id field of this attribute. This is |
---|
| 365 | * generally only ever called internally by the parser itself during |
---|
| 366 | * the parsing process. |
---|
| 367 | * |
---|
| 368 | * @param uriId The uriId of the attribute. |
---|
| 369 | */ |
---|
| 370 | void setURIId(const unsigned int uriId); |
---|
| 371 | |
---|
| 372 | /** |
---|
| 373 | * This method will update the datatype validator that was used |
---|
| 374 | * to assess the validity of the value of this attribute. |
---|
| 375 | * @param datatypeValidator DatatypeValidator used to assess the validity |
---|
| 376 | * of this attribute's value |
---|
| 377 | * @deprecated |
---|
| 378 | */ |
---|
| 379 | void setDatatypeValidator(DatatypeValidator * datatypeValidator); |
---|
| 380 | |
---|
| 381 | /** |
---|
| 382 | * This method will define whether the attribute was |
---|
| 383 | * validated by an XML Schema |
---|
| 384 | * @param isSchema true indicates that this attribute was validated |
---|
| 385 | * by an XML Schema; false indicates otherwise |
---|
| 386 | * @deprecated |
---|
| 387 | */ |
---|
| 388 | void setSchemaValidated(const bool isSchema); |
---|
| 389 | |
---|
| 390 | //@} |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | private : |
---|
| 395 | // ----------------------------------------------------------------------- |
---|
| 396 | // Unimplemented constructors and operators |
---|
| 397 | // ----------------------------------------------------------------------- |
---|
| 398 | XMLAttr(const XMLAttr&); |
---|
| 399 | XMLAttr& operator=(const XMLAttr&); |
---|
| 400 | |
---|
| 401 | |
---|
| 402 | // ----------------------------------------------------------------------- |
---|
| 403 | // Private, helper methods |
---|
| 404 | // ----------------------------------------------------------------------- |
---|
| 405 | void cleanUp(); |
---|
| 406 | |
---|
| 407 | |
---|
| 408 | // ----------------------------------------------------------------------- |
---|
| 409 | // Private instance variables |
---|
| 410 | // |
---|
| 411 | // fAttName |
---|
| 412 | // The Attribute Name; |
---|
| 413 | // |
---|
| 414 | // fSpecified |
---|
| 415 | // True if this attribute appeared in the element; else, false if |
---|
| 416 | // it was defaulted from an AttDef. |
---|
| 417 | // |
---|
| 418 | // fType |
---|
| 419 | // The attribute type enum value for this attribute. Indicates what |
---|
| 420 | // type of attribute it was. |
---|
| 421 | // |
---|
| 422 | // fValue |
---|
| 423 | // fValueBufSz |
---|
| 424 | // The attribute value that was given in the attribute instance, and |
---|
| 425 | // its current buffer size (minus one, where the null is.) |
---|
| 426 | // |
---|
| 427 | // fMemoryManager |
---|
| 428 | // The memory manager used for dynamic memory allocation/deallocation |
---|
| 429 | // fDatatypeValidator |
---|
| 430 | // The validator used to validate the value of this attribute. |
---|
| 431 | // The attribute does not own this object, and it is only |
---|
| 432 | // used in the calculation of DOMTypeInfo information. |
---|
| 433 | // fIsSchemaValidated |
---|
| 434 | // whether this attribute was validated by an XML Schema |
---|
| 435 | // |
---|
| 436 | // ----------------------------------------------------------------------- |
---|
| 437 | bool fSpecified; |
---|
| 438 | XMLAttDef::AttTypes fType; |
---|
| 439 | unsigned int fValueBufSz; |
---|
| 440 | XMLCh* fValue; |
---|
| 441 | QName* fAttName; |
---|
| 442 | MemoryManager* fMemoryManager; |
---|
| 443 | DatatypeValidator * fDatatypeValidator; |
---|
| 444 | bool fIsSchemaValidated; |
---|
| 445 | }; |
---|
| 446 | |
---|
| 447 | // --------------------------------------------------------------------------- |
---|
| 448 | // XMLAttr: Constructors and Destructor |
---|
| 449 | // --------------------------------------------------------------------------- |
---|
| 450 | inline XMLAttr::~XMLAttr() |
---|
| 451 | { |
---|
| 452 | cleanUp(); |
---|
| 453 | } |
---|
| 454 | |
---|
| 455 | |
---|
| 456 | // --------------------------------------------------------------------------- |
---|
| 457 | // XMLAttr: Getter methods |
---|
| 458 | // --------------------------------------------------------------------------- |
---|
| 459 | inline QName* XMLAttr::getAttName() const |
---|
| 460 | { |
---|
| 461 | return fAttName; |
---|
| 462 | } |
---|
| 463 | |
---|
| 464 | inline const XMLCh* XMLAttr::getName() const |
---|
| 465 | { |
---|
| 466 | return fAttName->getLocalPart(); |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | inline const XMLCh* XMLAttr::getPrefix() const |
---|
| 470 | { |
---|
| 471 | return fAttName->getPrefix(); |
---|
| 472 | } |
---|
| 473 | |
---|
| 474 | inline bool XMLAttr::getSpecified() const |
---|
| 475 | { |
---|
| 476 | return fSpecified; |
---|
| 477 | } |
---|
| 478 | |
---|
| 479 | inline XMLAttDef::AttTypes XMLAttr::getType() const |
---|
| 480 | { |
---|
| 481 | return fType; |
---|
| 482 | } |
---|
| 483 | |
---|
| 484 | inline const XMLCh* XMLAttr::getValue() const |
---|
| 485 | { |
---|
| 486 | return fValue; |
---|
| 487 | } |
---|
| 488 | |
---|
| 489 | inline unsigned int XMLAttr::getURIId() const |
---|
| 490 | { |
---|
| 491 | return fAttName->getURI(); |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | inline const XMLCh* XMLAttr::getValidatingTypeName() const |
---|
| 495 | { |
---|
| 496 | if(fIsSchemaValidated) |
---|
| 497 | { |
---|
| 498 | if(!fDatatypeValidator || fDatatypeValidator->getAnonymous()) |
---|
| 499 | return 0; |
---|
| 500 | return fDatatypeValidator->getTypeLocalName(); |
---|
| 501 | } |
---|
| 502 | else |
---|
| 503 | { |
---|
| 504 | return XMLAttDef::getAttTypeString(fType, fMemoryManager); |
---|
| 505 | } |
---|
| 506 | } |
---|
| 507 | |
---|
| 508 | inline const XMLCh* XMLAttr::getValidatingTypeURI() const |
---|
| 509 | { |
---|
| 510 | if(fIsSchemaValidated) |
---|
| 511 | { |
---|
| 512 | if(!fDatatypeValidator || fDatatypeValidator->getAnonymous()) |
---|
| 513 | return 0; |
---|
| 514 | return fDatatypeValidator->getTypeUri(); |
---|
| 515 | } |
---|
| 516 | else |
---|
| 517 | { |
---|
| 518 | return 0; |
---|
| 519 | } |
---|
| 520 | } |
---|
| 521 | |
---|
| 522 | // --------------------------------------------------------------------------- |
---|
| 523 | // XMLAttr: Setter methods |
---|
| 524 | // --------------------------------------------------------------------------- |
---|
| 525 | inline void XMLAttr::set(const unsigned int uriId |
---|
| 526 | , const XMLCh* const attrName |
---|
| 527 | , const XMLCh* const attrPrefix |
---|
| 528 | , const XMLCh* const attrValue |
---|
| 529 | , const XMLAttDef::AttTypes type |
---|
| 530 | , DatatypeValidator * datatypeValidator |
---|
| 531 | , const bool isSchema ) |
---|
| 532 | { |
---|
| 533 | // Set the name info and the value via their respective calls |
---|
| 534 | fAttName->setName(attrPrefix, attrName, uriId); |
---|
| 535 | setValue(attrValue); |
---|
| 536 | |
---|
| 537 | // And store the type |
---|
| 538 | fType = type; |
---|
| 539 | |
---|
| 540 | // and set up info for DOM type info |
---|
| 541 | fIsSchemaValidated = isSchema; |
---|
| 542 | fDatatypeValidator = datatypeValidator; |
---|
| 543 | } |
---|
| 544 | |
---|
| 545 | inline void XMLAttr::set(const unsigned int uriId |
---|
| 546 | , const XMLCh* const attrRawName |
---|
| 547 | , const XMLCh* const attrValue |
---|
| 548 | , const XMLAttDef::AttTypes type |
---|
| 549 | , DatatypeValidator * datatypeValidator |
---|
| 550 | , const bool isSchema ) |
---|
| 551 | { |
---|
| 552 | // Set the name info and the value via their respective calls |
---|
| 553 | fAttName->setName(attrRawName, uriId); |
---|
| 554 | setValue(attrValue); |
---|
| 555 | |
---|
| 556 | // And store the type |
---|
| 557 | fType = type; |
---|
| 558 | |
---|
| 559 | // and set up info for DOM type info |
---|
| 560 | fIsSchemaValidated = isSchema; |
---|
| 561 | fDatatypeValidator = datatypeValidator; |
---|
| 562 | } |
---|
| 563 | |
---|
| 564 | inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue) |
---|
| 565 | { |
---|
| 566 | fType = newValue; |
---|
| 567 | } |
---|
| 568 | |
---|
| 569 | inline void XMLAttr::setSpecified(const bool newValue) |
---|
| 570 | { |
---|
| 571 | fSpecified = newValue; |
---|
| 572 | } |
---|
| 573 | |
---|
| 574 | inline void XMLAttr::setDatatypeValidator(DatatypeValidator *datatypeValidator) |
---|
| 575 | { |
---|
| 576 | fDatatypeValidator = datatypeValidator; |
---|
| 577 | } |
---|
| 578 | |
---|
| 579 | inline void XMLAttr::setSchemaValidated(const bool isSchema) |
---|
| 580 | { |
---|
| 581 | fIsSchemaValidated = isSchema; |
---|
| 582 | } |
---|
| 583 | |
---|
| 584 | XERCES_CPP_NAMESPACE_END |
---|
| 585 | |
---|
| 586 | #endif |
---|