📄 xmlattr.hpp
字号:
* @param type The type of the attribute. This will indicate * the type of normalization done and constrains * the value content. Make sure that the value * set meets the constraints! * @param datatypeValidator type used to validate the attribute, * if it was validated by an XML Schema * @param isSchema true if and only if this attribute was validated * by an XML Schema */ void set ( const unsigned int uriId , const XMLCh* const attrRawName , const XMLCh* const attrValue , const XMLAttDef::AttTypes type = XMLAttDef::CData , DatatypeValidator * datatypeValidator = 0 , const bool isSchema = false ); /** * This method will update just the name related fields of the * attribute object. The other fields are left as is. * * @param uriId The id into the validator's URI pool of the URI * that the prefix mapped to. Only used if namespaces * are enabled/supported. * * @param attrName The base name of the attribute, i.e. the part * after any prefix. * * @param attrPrefix The prefix, if any, of this attribute's name. If * this is empty, then uriID is meaningless as well. */ void setName ( const unsigned int uriId , const XMLCh* const attrName , const XMLCh* const attrPrefix ); /** * This method will update the specified state of the object. * * @param newValue Indicates whether the attribute was explicitly * specified or not. If not, then it was faulted * in from a FIXED or DEFAULT value. */ void setSpecified(const bool newValue); /** * This method will update the attribute type of the object. * * @param newType The type of the attribute. This will indicate * the type of normalization done and constrains * the value content. Make sure that the value * set meets the constraints! */ void setType(const XMLAttDef::AttTypes newType); /** * This method will update the value field of the attribute. * * @param newValue The value string of the attribute, which should * be fully normalized by XML rules according to the * attribute type. */ void setValue(const XMLCh* const newValue); /** * This method will set the URI id field of this attribute. This is * generally only ever called internally by the parser itself during * the parsing process. * * @param uriId The uriId of the attribute. */ void setURIId(const unsigned int uriId); /** * This method will update the datatype validator that was used * to assess the validity of the value of this attribute. * @param datatypeValidator DatatypeValidator used to assess the validity * of this attribute's value * @deprecated */ void setDatatypeValidator(DatatypeValidator * datatypeValidator); /** * This method will define whether the attribute was * validated by an XML Schema * @param isSchema true indicates that this attribute was validated * by an XML Schema; false indicates otherwise * @deprecated */ void setSchemaValidated(const bool isSchema); //@}private : // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- XMLAttr(const XMLAttr&); XMLAttr& operator=(const XMLAttr&); // ----------------------------------------------------------------------- // Private, helper methods // ----------------------------------------------------------------------- void cleanUp(); // ----------------------------------------------------------------------- // Private instance variables // // fAttName // The Attribute Name; // // fSpecified // True if this attribute appeared in the element; else, false if // it was defaulted from an AttDef. // // fType // The attribute type enum value for this attribute. Indicates what // type of attribute it was. // // fValue // fValueBufSz // The attribute value that was given in the attribute instance, and // its current buffer size (minus one, where the null is.) // // fMemoryManager // The memory manager used for dynamic memory allocation/deallocation // fDatatypeValidator // The validator used to validate the value of this attribute. // The attribute does not own this object, and it is only // used in the calculation of DOMTypeInfo information. // fIsSchemaValidated // whether this attribute was validated by an XML Schema // // ----------------------------------------------------------------------- bool fSpecified; XMLAttDef::AttTypes fType; unsigned int fValueBufSz; XMLCh* fValue; QName* fAttName; MemoryManager* fMemoryManager; DatatypeValidator * fDatatypeValidator; bool fIsSchemaValidated;};// ---------------------------------------------------------------------------// XMLAttr: Constructors and Destructor// ---------------------------------------------------------------------------inline XMLAttr::~XMLAttr(){ cleanUp();}// ---------------------------------------------------------------------------// XMLAttr: Getter methods// ---------------------------------------------------------------------------inline QName* XMLAttr::getAttName() const{ return fAttName;}inline const XMLCh* XMLAttr::getName() const{ return fAttName->getLocalPart();}inline const XMLCh* XMLAttr::getPrefix() const{ return fAttName->getPrefix();}inline bool XMLAttr::getSpecified() const{ return fSpecified;}inline XMLAttDef::AttTypes XMLAttr::getType() const{ return fType;}inline const XMLCh* XMLAttr::getValue() const{ return fValue;}inline unsigned int XMLAttr::getURIId() const{ return fAttName->getURI();}inline const XMLCh* XMLAttr::getValidatingTypeName() const{ if(fIsSchemaValidated) { if(!fDatatypeValidator || fDatatypeValidator->getAnonymous()) return 0; return fDatatypeValidator->getTypeLocalName(); } else { return XMLAttDef::getAttTypeString(fType, fMemoryManager); }}inline const XMLCh* XMLAttr::getValidatingTypeURI() const{ if(fIsSchemaValidated) { if(!fDatatypeValidator || fDatatypeValidator->getAnonymous()) return 0; return fDatatypeValidator->getTypeUri(); } else { return 0; }}// ---------------------------------------------------------------------------// XMLAttr: Setter methods// ---------------------------------------------------------------------------inline void XMLAttr::set(const unsigned int uriId , const XMLCh* const attrName , const XMLCh* const attrPrefix , const XMLCh* const attrValue , const XMLAttDef::AttTypes type , DatatypeValidator * datatypeValidator , const bool isSchema ){ // Set the name info and the value via their respective calls fAttName->setName(attrPrefix, attrName, uriId); setValue(attrValue); // And store the type fType = type; // and set up info for DOM type info fIsSchemaValidated = isSchema; fDatatypeValidator = datatypeValidator;}inline void XMLAttr::set(const unsigned int uriId , const XMLCh* const attrRawName , const XMLCh* const attrValue , const XMLAttDef::AttTypes type , DatatypeValidator * datatypeValidator , const bool isSchema ){ // Set the name info and the value via their respective calls fAttName->setName(attrRawName, uriId); setValue(attrValue); // And store the type fType = type; // and set up info for DOM type info fIsSchemaValidated = isSchema; fDatatypeValidator = datatypeValidator;}inline void XMLAttr::setType(const XMLAttDef::AttTypes newValue){ fType = newValue;}inline void XMLAttr::setSpecified(const bool newValue){ fSpecified = newValue;}inline void XMLAttr::setDatatypeValidator(DatatypeValidator *datatypeValidator){ fDatatypeValidator = datatypeValidator;}inline void XMLAttr::setSchemaValidated(const bool isSchema){ fIsSchemaValidated = isSchema;}XERCES_CPP_NAMESPACE_END#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -