00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 #if !defined(XMLATTR_HPP)
00119 #define XMLATTR_HPP
00120
00121 #include <xercesc/util/PlatformUtils.hpp>
00122 #include <xercesc/util/QName.hpp>
00123 #include <xercesc/framework/XMLAttDef.hpp>
00124 #include <xercesc/validators/datatype/DatatypeValidator.hpp>
00125
00126 XERCES_CPP_NAMESPACE_BEGIN
00127
00149 class XMLAttr : public XMemory
00150 {
00151 public:
00152
00153
00154
00157
00165 XMLAttr(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00166
00199 XMLAttr
00200 (
00201 const unsigned int uriId
00202 , const XMLCh* const attrName
00203 , const XMLCh* const attrPrefix
00204 , const XMLCh* const attrValue
00205 , const XMLAttDef::AttTypes type = XMLAttDef::CData
00206 , const bool specified = true
00207 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00208 , DatatypeValidator * datatypeValidator = 0
00209 , const bool isSchema = false
00210 );
00211
00240 XMLAttr
00241 (
00242 const unsigned int uriId
00243 , const XMLCh* const rawName
00244 , const XMLCh* const attrValue
00245 , const XMLAttDef::AttTypes type = XMLAttDef::CData
00246 , const bool specified = true
00247 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
00248 , DatatypeValidator * datatypeValidator = 0
00249 , const bool isSchema = false
00250 );
00251
00253
00256 ~XMLAttr();
00258
00259
00260
00261
00262
00263
00266
00270 QName* getAttName() const;
00271
00276 const XMLCh* getName() const;
00277
00282 const XMLCh* getPrefix() const;
00283
00289 const XMLCh* getQName() const;
00290
00295 bool getSpecified() const;
00296
00301 XMLAttDef::AttTypes getType() const;
00302
00308 const XMLCh* getValue() const;
00309
00314 unsigned int getURIId() const;
00315
00319 const XMLCh* getValidatingTypeURI() const;
00320
00324 const XMLCh* getValidatingTypeName() const;
00325
00327
00328
00329
00330
00331
00332
00335
00364 void set
00365 (
00366 const unsigned int uriId
00367 , const XMLCh* const attrName
00368 , const XMLCh* const attrPrefix
00369 , const XMLCh* const attrValue
00370 , const XMLAttDef::AttTypes type = XMLAttDef::CData
00371 , DatatypeValidator * datatypeValidator = 0
00372 , const bool isSchema = false
00373 );
00374
00398 void set
00399 (
00400 const unsigned int uriId
00401 , const XMLCh* const attrRawName
00402 , const XMLCh* const attrValue
00403 , const XMLAttDef::AttTypes type = XMLAttDef::CData
00404 , DatatypeValidator * datatypeValidator = 0
00405 , const bool isSchema = false
00406 );
00407
00422 void setName
00423 (
00424 const unsigned int uriId
00425 , const XMLCh* const attrName
00426 , const XMLCh* const attrPrefix
00427 );
00428
00436 void setSpecified(const bool newValue);
00437
00446 void setType(const XMLAttDef::AttTypes newType);
00447
00455 void setValue(const XMLCh* const newValue);
00456
00464 void setURIId(const unsigned int uriId);
00465
00472 void setDatatypeValidator(DatatypeValidator * datatypeValidator);
00473
00480 void setSchemaValidated(const bool isSchema);
00481
00483
00484
00485
00486 private :
00487
00488
00489
00490 XMLAttr(const XMLAttr&);
00491 XMLAttr& operator=(const XMLAttr&);
00492
00493
00494
00495
00496
00497 void cleanUp();
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529 bool fSpecified;
00530 XMLAttDef::AttTypes fType;
00531 unsigned int fValueBufSz;
00532 XMLCh* fValue;
00533 QName* fAttName;
00534 MemoryManager* fMemoryManager;
00535 DatatypeValidator * fDatatypeValidator;
00536 bool fIsSchemaValidated;
00537 };
00538
00539
00540
00541
00542 inline XMLAttr::~XMLAttr()
00543 {
00544 cleanUp();
00545 }
00546
00547
00548
00549
00550
00551 inline QName* XMLAttr::getAttName() const
00552 {
00553 return fAttName;
00554 }
00555
00556 inline const XMLCh* XMLAttr::getName() const
00557 {
00558 return fAttName->getLocalPart();
00559 }
00560
00561 inline const XMLCh* XMLAttr::getPrefix() const
00562 {
00563 return fAttName->getPrefix();
00564 }
00565
00566 inline bool XMLAttr::getSpecified() const
00567 {
00568 return fSpecified;
00569 }
00570
00571 inline XMLAttDef::AttTypes XMLAttr::getType() const
00572 {
00573 return fType;
00574 }
00575
00576 inline const XMLCh* XMLAttr::getValue() const
00577 {
00578 return fValue;
00579 }
00580
00581 inline unsigned int XMLAttr::getURIId() const
00582 {
00583 return fAttName->getURI();
00584 }
00585
00586 inline const XMLCh* XMLAttr::getValidatingTypeName() const
00587 {
00588 if(fIsSchemaValidated)
00589 {
00590 if(!fDatatypeValidator || fDatatypeValidator->getAnonymous())
00591 return 0;
00592 return fDatatypeValidator->getTypeLocalName();
00593 }
00594 else
00595 {
00596 return XMLAttDef::getAttTypeString(fType);
00597 }
00598 }
00599
00600 inline const XMLCh* XMLAttr::getValidatingTypeURI() const
00601 {
00602 if(fIsSchemaValidated)
00603 {
00604 if(!fDatatypeValidator || fDatatypeValidator->getAnonymous())
00605 return 0;
00606 return fDatatypeValidator->getTypeUri();
00607 }
00608 else
00609 {
00610 return 0;
00611 }
00612 }
00613
00614
00615
00616
00617 inline void XMLAttr::set(const unsigned int uriId
00618 , const XMLCh* const attrName
00619 , const XMLCh* const attrPrefix
00620 , const XMLCh* const attrValue
00621 , const XMLAttDef::AttTypes type
00622 , DatatypeValidator * datatypeValidator
00623 , const bool isSchema )
00624 {
00625
00626 fAttName->setName(attrPrefix, attrName, uriId);
00627 setValue(attrValue);
00628
00629
00630 fType = type;
00631
00632
00633 fIsSchemaValidated = isSchema;
00634 fDatatypeValidator = datatypeValidator;
00635 }
00636
00637 inline void XMLAttr::set(const unsigned int uriId
00638 , const XMLCh* const attrRawName
00639 , const XMLCh* const attrValue
00640 , const XMLAttDef::AttTypes type
00641 , DatatypeValidator * datatypeValidator
00642 , const bool isSchema )
00643 {
00644
00645 fAttName->setName(attrRawName, uriId);
00646 setValue(attrValue);
00647
00648
00649 fType = type;
00650
00651
00652 fIsSchemaValidated = isSchema;
00653 fDatatypeValidator = datatypeValidator;
00654 }
00655
00656 inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue)
00657 {
00658 fType = newValue;
00659 }
00660
00661 inline void XMLAttr::setSpecified(const bool newValue)
00662 {
00663 fSpecified = newValue;
00664 }
00665
00666 inline void XMLAttr::setDatatypeValidator(DatatypeValidator *datatypeValidator)
00667 {
00668 fDatatypeValidator = datatypeValidator;
00669 }
00670
00671 inline void XMLAttr::setSchemaValidated(const bool isSchema)
00672 {
00673 fIsSchemaValidated = isSchema;
00674 }
00675
00676 XERCES_CPP_NAMESPACE_END
00677
00678 #endif