You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2003/11/24 06:19:37 UTC

cvs commit: xml-xerces/c/src/xercesc/framework XMLAttr.cpp XMLAttr.hpp

neilg       2003/11/23 21:19:37

  Modified:    c/src/xercesc/framework XMLAttr.cpp XMLAttr.hpp
  Log:
  update XMLAttr class to carry information needed by DOMTypeInfo
  
  Revision  Changes    Path
  1.7       +13 -3     xml-xerces/c/src/xercesc/framework/XMLAttr.cpp
  
  Index: XMLAttr.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLAttr.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLAttr.cpp	1 Oct 2003 16:32:37 -0000	1.6
  +++ XMLAttr.cpp	24 Nov 2003 05:19:37 -0000	1.7
  @@ -79,6 +79,8 @@
       , fValue(0)
       , fAttName(0)
       , fMemoryManager(manager)
  +    , fDatatypeValidator(0)
  +    , fIsSchemaValidated(false)
   {
       fAttName = new (fMemoryManager) QName(fMemoryManager);
   }
  @@ -89,7 +91,9 @@
                       , const XMLCh* const        attrValue
                       , const XMLAttDef::AttTypes type
                       , const bool                specified
  -                    , MemoryManager* const      manager) :
  +                    , MemoryManager* const      manager 
  +                    , DatatypeValidator * datatypeValidator
  +                    , const bool isSchema ):
   
         fSpecified(specified)
       , fType(type)
  @@ -97,6 +101,8 @@
       , fValue(0)
       , fAttName(0)
       , fMemoryManager(manager)
  +    , fDatatypeValidator(datatypeValidator)
  +    , fIsSchemaValidated(isSchema)
   {
       try
       {
  @@ -122,7 +128,9 @@
                       , const XMLCh* const        attrValue
                       , const XMLAttDef::AttTypes type
                       , const bool                specified
  -                    , MemoryManager* const      manager) :
  +                    , MemoryManager* const      manager 
  +                    , DatatypeValidator * datatypeValidator
  +                    , const bool isSchema ):
   
         fSpecified(specified)
       , fType(type)
  @@ -130,6 +138,8 @@
       , fValue(0)
       , fAttName(0)
       , fMemoryManager(manager)
  +    , fDatatypeValidator(datatypeValidator)
  +    , fIsSchemaValidated(isSchema)
   {
       try
       {
  
  
  
  1.8       +114 -4    xml-xerces/c/src/xercesc/framework/XMLAttr.hpp
  
  Index: XMLAttr.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLAttr.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLAttr.hpp	22 May 2003 02:10:51 -0000	1.7
  +++ XMLAttr.hpp	24 Nov 2003 05:19:37 -0000	1.8
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.8  2003/11/24 05:19:37  neilg
  + * update XMLAttr class to carry information needed by DOMTypeInfo
  + *
    * Revision 1.7  2003/05/22 02:10:51  knoaman
    * Default the memory manager.
    *
  @@ -118,6 +121,7 @@
   #include <xercesc/util/PlatformUtils.hpp>
   #include <xercesc/util/QName.hpp>
   #include <xercesc/framework/XMLAttDef.hpp>
  +#include <xercesc/validators/datatype/DatatypeValidator.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -187,6 +191,10 @@
         *                     in from a FIXED or DEFAULT value.
         *
         * @param  manager     The configurable memory manager
  +      * @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
         */
       XMLAttr
       (
  @@ -197,6 +205,8 @@
           , const XMLAttDef::AttTypes type = XMLAttDef::CData
           , const bool                specified = true
           , MemoryManager* const      manager = XMLPlatformUtils::fgMemoryManager
  +        , DatatypeValidator * datatypeValidator = 0
  +        , const bool isSchema = false
       );
   
       /**
  @@ -222,6 +232,10 @@
         *                     in from a FIXED or DEFAULT value.
         *
         * @param  manager     The configurable memory manager
  +      * @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
         */
       XMLAttr
       (
  @@ -231,6 +245,8 @@
           , const XMLAttDef::AttTypes type = XMLAttDef::CData
           , const bool specified = true
           , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
  +        , DatatypeValidator * datatypeValidator = 0
  +        , const bool isSchema = false
       );
   
       //@}
  @@ -297,6 +313,16 @@
         */
       unsigned int getURIId() const;
   
  +    /**
  +     * @return the uri part of DOM Level 3 TypeInfo
  +     */
  +    const XMLCh* getValidatingTypeURI() const;
  +
  +    /**
  +     * @return the name part of DOM Level 3 TypeInfo
  +     */
  +    const XMLCh* getValidatingTypeName() const;
  +
       //@}
   
   
  @@ -329,6 +355,10 @@
         *                     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
  @@ -338,6 +368,8 @@
           , const XMLCh* const        attrPrefix
           , const XMLCh* const        attrValue
           , const XMLAttDef::AttTypes type = XMLAttDef::CData
  +        , DatatypeValidator * datatypeValidator = 0
  +        , const bool isSchema = false
       );
   
       /**
  @@ -358,7 +390,10 @@
         *                     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
       (
  @@ -366,6 +401,8 @@
           , const XMLCh* const        attrRawName
           , const XMLCh* const        attrValue
           , const XMLAttDef::AttTypes type = XMLAttDef::CData
  +        , DatatypeValidator * datatypeValidator = 0
  +        , const bool isSchema = false
       );
   
       /**
  @@ -426,6 +463,22 @@
         */
       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
  +      */
  +    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
  +      */
  +    void setSchemaValidated(const bool isSchema);
  +
       //@}
   
   
  @@ -465,6 +518,12 @@
       //
       //  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;
  @@ -473,6 +532,8 @@
       XMLCh*              fValue;
       QName*              fAttName;
       MemoryManager*      fMemoryManager;
  +    DatatypeValidator * fDatatypeValidator;
  +    bool                fIsSchemaValidated;
   };
   
   // ---------------------------------------------------------------------------
  @@ -522,6 +583,33 @@
       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);
  +    }
  +}
  +
  +inline const XMLCh* XMLAttr::getValidatingTypeURI() const
  +{
  +    if(fIsSchemaValidated)
  +    {
  +        if(!fDatatypeValidator || fDatatypeValidator->getAnonymous())
  +            return 0; 
  +        return fDatatypeValidator->getTypeUri();
  +    }
  +    else
  +    {
  +        return 0;
  +    }
  +}
   
   // ---------------------------------------------------------------------------
   //  XMLAttr: Setter methods
  @@ -530,7 +618,9 @@
                           , const XMLCh* const        attrName
                           , const XMLCh* const        attrPrefix
                           , const XMLCh* const        attrValue
  -                        , const XMLAttDef::AttTypes type)
  +                        , 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);
  @@ -538,12 +628,18 @@
   
       // 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)
  +                        , const XMLAttDef::AttTypes type
  +                        , DatatypeValidator * datatypeValidator 
  +                        , const bool isSchema )
   {
       // Set the name info and the value via their respective calls
       fAttName->setName(attrRawName, uriId);
  @@ -551,6 +647,10 @@
   
       // 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)
  @@ -561,6 +661,16 @@
   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
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org