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

cvs commit: xml-xerces/c/src/xercesc/validators/datatype UnionDatatypeValidator.hpp UnionDatatypeValidator.cpp TimeDatatypeValidator.hpp TimeDatatypeValidator.cpp ListDatatypeValidator.hpp ListDatatypeValidator.cpp DecimalDatatypeValidator.hpp DecimalDatatypeValidator.cpp DateTimeDatatypeValidator.hpp DateTimeDatatypeValidator.cpp DatatypeValidator.hpp DatatypeValidator.cpp BooleanDatatypeValidator.hpp BooleanDatatypeValidator.cpp AbstractNumericValidator.hpp AbstractNumericValidator.cpp

peiyongz    2003/11/28 10:53:08

  Modified:    c/src/xercesc/validators/datatype UnionDatatypeValidator.hpp
                        UnionDatatypeValidator.cpp
                        TimeDatatypeValidator.hpp TimeDatatypeValidator.cpp
                        ListDatatypeValidator.hpp ListDatatypeValidator.cpp
                        DecimalDatatypeValidator.hpp
                        DecimalDatatypeValidator.cpp
                        DateTimeDatatypeValidator.hpp
                        DateTimeDatatypeValidator.cpp DatatypeValidator.hpp
                        DatatypeValidator.cpp BooleanDatatypeValidator.hpp
                        BooleanDatatypeValidator.cpp
                        AbstractNumericValidator.hpp
                        AbstractNumericValidator.cpp
  Log:
  Support for getCanonicalRepresentation
  
  Revision  Changes    Path
  1.14      +11 -2     xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp
  
  Index: UnionDatatypeValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- UnionDatatypeValidator.hpp	24 Nov 2003 05:10:26 -0000	1.13
  +++ UnionDatatypeValidator.hpp	28 Nov 2003 18:53:07 -0000	1.14
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.14  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.13  2003/11/24 05:10:26  neilg
    * implement method for determining member type of union that validated some value
    *
  @@ -193,6 +196,12 @@
         * Returns whether the type is atomic or not
         */
       virtual bool isAtomic() const;
  +
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
   
       //@}
   
  
  
  
  1.19      +46 -2     xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp
  
  Index: UnionDatatypeValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/UnionDatatypeValidator.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- UnionDatatypeValidator.cpp	24 Nov 2003 05:10:26 -0000	1.18
  +++ UnionDatatypeValidator.cpp	28 Nov 2003 18:53:07 -0000	1.19
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.19  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.18  2003/11/24 05:10:26  neilg
    * implement method for determining member type of union that validated some value
    *
  @@ -468,6 +471,47 @@
   {
   	return getEnumeration();
   }
  +
  +/***
  + * 2.5.1.3 Union datatypes
  + *
  + * The canonical-lexical-representation for a �union� datatype is defined as the lexical form 
  + * in which the values have the canonical lexical representation of the appropriate �memberTypes�.       
  + ***/
  +const XMLCh* UnionDatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                              ,       MemoryManager* const memMgr ) const
  +{
  +
  +    UnionDatatypeValidator* temp = (UnionDatatypeValidator*) this;
  +    temp->checkContent(rawData, 0, false);
  +
  +    //get the native unionDv
  +    UnionDatatypeValidator* bdv = (UnionDatatypeValidator*) temp->getBaseValidator();
  +    while (bdv)
  +    {
  +        temp = bdv;
  +        bdv = (UnionDatatypeValidator*) temp->getBaseValidator();
  +    }
  +
  +    //let the member dv which recognize the rawData, to return
  +    //us the canonical form
  +    for ( unsigned int i = 0; i < fMemberTypeValidators->size(); ++i )
  +    {
  +        try
  +        {
  +            fMemberTypeValidators->elementAt(i)->validate(rawData, 0);
  +            return fMemberTypeValidators->elementAt(i)->getCanonicalRepresentation(rawData);
  +        }
  +        catch (XMLException&)
  +        {
  +            //absorbed
  +        }
  +    }
  +
  +    //its not likely we reach here, but who knows ...
  +    return 0;
  +}
  +
   
   /***
    * Support for Serialization/De-serialization
  
  
  
  1.7       +10 -1     xml-xerces/c/src/xercesc/validators/datatype/TimeDatatypeValidator.hpp
  
  Index: TimeDatatypeValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/TimeDatatypeValidator.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TimeDatatypeValidator.hpp	2 Oct 2003 19:21:06 -0000	1.6
  +++ TimeDatatypeValidator.hpp	28 Nov 2003 18:53:07 -0000	1.7
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.7  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.6  2003/10/02 19:21:06  peiyongz
    * Implementation of Serialization/Deserialization
    *
  @@ -126,6 +129,12 @@
           , const int finalSet
           , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
       );
  +
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
   
       /***
        * Support for Serialization/De-serialization
  
  
  
  1.10      +24 -1     xml-xerces/c/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp
  
  Index: TimeDatatypeValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/TimeDatatypeValidator.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TimeDatatypeValidator.cpp	6 Nov 2003 15:30:07 -0000	1.9
  +++ TimeDatatypeValidator.cpp	28 Nov 2003 18:53:07 -0000	1.10
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.10  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.9  2003/11/06 15:30:07  neilg
    * first part of PSVI/schema component model implementation, thanks to David Cargill.  This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse.
    *
  @@ -164,6 +167,26 @@
   void TimeDatatypeValidator::parse(XMLDateTime* const pDate)
   {
       pDate->parseTime();
  +}
  +
  +/***
  + * 3.2.8 time
  + *
  + *  . either the time zone must be omitted or, 
  + *    if present, the time zone must be Coordinated Universal Time (UTC) indicated by a "Z".   
  + *
  + *  . Additionally, the canonical representation for midnight is 00:00:00.
  + *
  +***/
  +const XMLCh* TimeDatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                              ,      MemoryManager* const memMgr) const
  +{
  +    TimeDatatypeValidator* temp = (TimeDatatypeValidator*) this;
  +    temp->checkContent(rawData, 0, false);
  +
  +    MemoryManager* toUse = memMgr? memMgr : fMemoryManager;
  +    //todo: change behaviour later
  +    return XMLString::replicate(rawData, toUse);
   }
   
   /***
  
  
  
  1.9       +11 -1     xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
  
  Index: ListDatatypeValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ListDatatypeValidator.hpp	12 Nov 2003 20:32:03 -0000	1.8
  +++ ListDatatypeValidator.hpp	28 Nov 2003 18:53:07 -0000	1.9
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.9  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.8  2003/11/12 20:32:03  peiyongz
    * Statless Grammar: ValidationContext
    *
  @@ -156,6 +159,13 @@
         * Returns whether the type is atomic or not
         */
       virtual bool isAtomic() const;
  +
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
  +
       //@}
   
       // -----------------------------------------------------------------------
  
  
  
  1.13      +40 -1     xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
  
  Index: ListDatatypeValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/ListDatatypeValidator.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ListDatatypeValidator.cpp	12 Nov 2003 20:32:03 -0000	1.12
  +++ ListDatatypeValidator.cpp	28 Nov 2003 18:53:07 -0000	1.13
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.13  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.12  2003/11/12 20:32:03  peiyongz
    * Statless Grammar: ValidationContext
    *
  @@ -484,6 +487,42 @@
           AbstractStringValidator::inheritFacet();
       }
   
  +}
  +
  +/***
  + * 2.5.1.2 List datatypes   
  + *   
  + * The canonical-lexical-representation for the �list� datatype is defined as 
  + * the lexical form in which each item in the �list� has the canonical 
  + * lexical representation of its �itemType�.
  + ***/
  +const XMLCh* ListDatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                             ,       MemoryManager* const memMgr) const
  +{
  +    ListDatatypeValidator* temp = (ListDatatypeValidator*) this;
  +
  +    temp->setContent(rawData);
  +    BaseRefVectorOf<XMLCh>* tokenVector = XMLString::tokenizeString(rawData);
  +    Janitor<BaseRefVectorOf<XMLCh> > janName(tokenVector);
  +    temp->checkContent(tokenVector, rawData, 0, false);
  +
  +    MemoryManager* toUse = memMgr? memMgr : getMemoryManager();
  +    int  retBufSize = 2 * XMLString::stringLen(rawData);
  +    XMLCh* retBuf = (XMLCh*) toUse->allocate(retBufSize * sizeof(XMLCh));
  +    XMLCh* retBufPtr = retBuf;
  +
  +    DatatypeValidator* itemDv = this->getItemTypeDTV();
  +    for (unsigned int i = 0; i < tokenVector->size(); i++)
  +    {
  +        XMLCh* itemCanRep = (XMLCh*) itemDv->getCanonicalRepresentation(tokenVector->elementAt(i), memMgr);
  +        XMLString::catString(retBufPtr, itemCanRep);
  +        retBufPtr = retBufPtr + XMLString::stringLen(itemCanRep) + 1;
  +        *(retBufPtr++) = chSpace;
  +        *(retBufPtr) = chNull;
  +        toUse->deallocate(itemCanRep);
  +    }
  +
  +    return 0;
   }
   
   /***
  
  
  
  1.10      +10 -1     xml-xerces/c/src/xercesc/validators/datatype/DecimalDatatypeValidator.hpp
  
  Index: DecimalDatatypeValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DecimalDatatypeValidator.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DecimalDatatypeValidator.hpp	12 Nov 2003 20:32:03 -0000	1.9
  +++ DecimalDatatypeValidator.hpp	28 Nov 2003 18:53:07 -0000	1.10
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.10  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.9  2003/11/12 20:32:03  peiyongz
    * Statless Grammar: ValidationContext
    *
  @@ -162,6 +165,12 @@
           , const int finalSet
           , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
       );
  +
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
   
       /***
        * Support for Serialization/De-serialization
  
  
  
  1.17      +69 -0     xml-xerces/c/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp
  
  Index: DecimalDatatypeValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DecimalDatatypeValidator.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DecimalDatatypeValidator.cpp	12 Nov 2003 20:32:03 -0000	1.16
  +++ DecimalDatatypeValidator.cpp	28 Nov 2003 18:53:07 -0000	1.17
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.17  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.16  2003/11/12 20:32:03  peiyongz
    * Statless Grammar: ValidationContext
    *
  @@ -620,6 +623,72 @@
          ThrowXML1(InvalidDatatypeFacetException, XMLExcepts::RethrowError, e.getMessage());
       }
   
  +}
  +
  +/***
  + * 3.2.3 decimal  
  + *
  + * . the preceding optional "+" sign is prohibited. 
  + * . The decimal point is required. 
  + * . Leading and trailing zeroes are prohibited subject to the following: 
  + *   there must be at least one digit to the right and to the left of the decimal point which may be a zero.
  + *
  + *
  + *  3.3.13 integer
  + *  3.3.16 long
  + *  3.3.17 int
  + *  3.3.18 short 
  + *  3.3.19 byte
  + *  3.3.20 nonNegativeInteger
  + *  3.3.25 positiveInteger
  + *
  + *   . the preceding optional "+" sign is prohibited and
  + *   . leading zeroes are prohibited.
  + *   
  + *  3.3.14 nonPositiveInteger
  + *
  + *  . the negative sign ("-") is required with the token "0" and 
  + *  . leading zeroes are prohibited.
  + *  
  + *  3.3.15 negativeInteger
  + *  3.3.21 unsignedLong
  + *  3.3.22 unsignedInt
  + *  3.3.23 unsignedShort
  + *  3.3.24 unsignedByte
  + *
  + *  . leading zeroes are prohibited.
  + *  
  + *  todo:
  + *    In order to implement this method, this class shall have a way to tell if itself
  + *    is an 'int', or 'unsignedLong', or something list above, not merely 'Decimal'.
  + *
  + *    Thus we need to extend DatatypeValidator::ValidatorType to include these
  + *    'new' dv types. And assign them the value the way that once AND with mask
  + *    it would be 'Decimal', and all the existing dv type would remain what they
  + *    are.
  + *
  + *    eg. 'String' & mask = 'String'
  + *        'AnyURI' & mask = 'AnyURI',
  + *
  + *        'int'    & mask = 'Decimal'
  + *        'long'   & mask = 'long'
  + *    
  + *    thus, when deserialize, we can create 'Decimal'dv even they are 'int',
  + *    'long'.
  + *
  + *    All dv' ctor need to carry an extra field DatatypeValidator::ValidatorType
  + *    to specify who it is rather than merely relying on the c++ object itself.
  + *
  + ***/
  +const XMLCh* DecimalDatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                                 ,      MemoryManager* const memMgr) const
  +{
  +    DecimalDatatypeValidator* temp = (DecimalDatatypeValidator*) this;
  +    temp->checkContent(rawData, 0, false);
  +
  +    MemoryManager* toUse = memMgr? memMgr : fMemoryManager;
  +    //todo: change behaviour later
  +    return XMLString::replicate(rawData, toUse);
   }
   
   /***
  
  
  
  1.7       +10 -1     xml-xerces/c/src/xercesc/validators/datatype/DateTimeDatatypeValidator.hpp
  
  Index: DateTimeDatatypeValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DateTimeDatatypeValidator.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DateTimeDatatypeValidator.hpp	2 Oct 2003 19:21:06 -0000	1.6
  +++ DateTimeDatatypeValidator.hpp	28 Nov 2003 18:53:07 -0000	1.7
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.7  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.6  2003/10/02 19:21:06  peiyongz
    * Implementation of Serialization/Deserialization
    *
  @@ -124,6 +127,12 @@
           , const int finalSet
           , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
       );
  +
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
   
       /***
        * Support for Serialization/De-serialization
  
  
  
  1.10      +21 -1     xml-xerces/c/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp
  
  Index: DateTimeDatatypeValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DateTimeDatatypeValidator.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DateTimeDatatypeValidator.cpp	6 Nov 2003 15:30:07 -0000	1.9
  +++ DateTimeDatatypeValidator.cpp	28 Nov 2003 18:53:07 -0000	1.10
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.10  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.9  2003/11/06 15:30:07  neilg
    * first part of PSVI/schema component model implementation, thanks to David Cargill.  This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse.
    *
  @@ -164,6 +167,23 @@
   void DateTimeDatatypeValidator::parse(XMLDateTime* const pDate)
   {
       pDate->parseDateTime();
  +}
  +
  +/***
  + *3.2.7 dateTime
  + *
  + *  . either the time zone must be omitted or, 
  + *    if present, the time zone must be Coordinated Universal Time (UTC) indicated by a "Z".
  + ***/   
  +const XMLCh* DateTimeDatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                                  ,      MemoryManager* const memMgr) const
  +{
  +    DateTimeDatatypeValidator* temp = (DateTimeDatatypeValidator*) this;
  +    temp->checkContent(rawData, 0, false);
  +
  +    MemoryManager* toUse = memMgr? memMgr : fMemoryManager;
  +    //todo: change behaviour later
  +    return XMLString::replicate(rawData, toUse);
   }
   
   /***
  
  
  
  1.21      +23 -1     xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.hpp
  
  Index: DatatypeValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.hpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DatatypeValidator.hpp	24 Nov 2003 15:45:36 -0000	1.20
  +++ DatatypeValidator.hpp	28 Nov 2003 18:53:07 -0000	1.21
  @@ -239,6 +239,28 @@
        */
       bool getNumeric() const;
   
  +    /**
  +     *    Canonical Representation
  +     *
  +     *    Derivative datatype may overwrite this method once
  +     *    it has its own canonical representation other than
  +     *    the default one.
  +     *
  +     * @param rawData: data in raw string
  +     * @param memMgr:  memory manager
  +     *
  +     * @return: canonical representation of the data
  +     * 
  +     * Note:  user need to use the dv's memory manager to
  +     *        deallocate the memory for the string returned.
  +     *
  +     */
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
  +
       //@}
   
       // -----------------------------------------------------------------------
  
  
  
  1.18      +17 -0     xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.cpp
  
  Index: DatatypeValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/DatatypeValidator.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DatatypeValidator.cpp	13 Nov 2003 23:19:18 -0000	1.17
  +++ DatatypeValidator.cpp	28 Nov 2003 18:53:07 -0000	1.18
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.18  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.17  2003/11/13 23:19:18  peiyongz
    * initSize
    *
  @@ -626,6 +629,20 @@
   {
       return dv? DatatypeValidatorFactory::getBuiltInRegistry()->containsKey(dv->getTypeName())
                : false;
  +}
  +
  +/**
  + * Canonical Representation
  + *
  + */
  +const XMLCh* DatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                          ,      MemoryManager* const memMgr) const
  +{
  +    DatatypeValidator *temp = (DatatypeValidator*) this;
  +    temp->validate(rawData, 0);
  +
  +    MemoryManager* toUse = memMgr? memMgr : fMemoryManager;
  +    return XMLString::replicate(rawData, toUse);
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.9       +6 -2      xml-xerces/c/src/xercesc/validators/datatype/BooleanDatatypeValidator.hpp
  
  Index: BooleanDatatypeValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/BooleanDatatypeValidator.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BooleanDatatypeValidator.hpp	12 Nov 2003 20:32:03 -0000	1.8
  +++ BooleanDatatypeValidator.hpp	28 Nov 2003 18:53:07 -0000	1.9
  @@ -100,7 +100,11 @@
       /** @name Getter Functions */
       //@{
   
  -
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
       //@}
   
       // -----------------------------------------------------------------------
  
  
  
  1.11      +23 -0     xml-xerces/c/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp
  
  Index: BooleanDatatypeValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/BooleanDatatypeValidator.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- BooleanDatatypeValidator.cpp	12 Nov 2003 20:32:03 -0000	1.10
  +++ BooleanDatatypeValidator.cpp	28 Nov 2003 18:53:07 -0000	1.11
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.11  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.10  2003/11/12 20:32:03  peiyongz
    * Statless Grammar: ValidationContext
    *
  @@ -259,6 +262,26 @@
   const RefArrayVectorOf<XMLCh>* BooleanDatatypeValidator::getEnumString() const
   {
   	return 0;
  +}
  +
  +/***
  + * 3.2.2.2 Canonical representation
  + *
  + * The canonical representation for boolean is the set of literals {true, false}.
  + ***/
  +const XMLCh* BooleanDatatypeValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                                ,       MemoryManager* const memMgr) const
  +{
  +    BooleanDatatypeValidator *temp = (BooleanDatatypeValidator*) this;
  +    temp->checkContent(rawData, 0, false);
  +
  +    MemoryManager* toUse = memMgr? memMgr : getMemoryManager();
  +
  +    return ( XMLString::equals(rawData, fgValueSpace[0]) ||
  +             XMLString::equals(rawData, fgValueSpace[2])  ) ?
  +             XMLString::replicate(fgValueSpace[0], toUse) :
  +             XMLString::replicate(fgValueSpace[1], toUse) ;
  +
   }
   
   /***
  
  
  
  1.7       +10 -1     xml-xerces/c/src/xercesc/validators/datatype/AbstractNumericValidator.hpp
  
  Index: AbstractNumericValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/AbstractNumericValidator.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractNumericValidator.hpp	12 Nov 2003 20:32:03 -0000	1.6
  +++ AbstractNumericValidator.hpp	28 Nov 2003 18:53:07 -0000	1.7
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.7  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.6  2003/11/12 20:32:03  peiyongz
    * Statless Grammar: ValidationContext
    *
  @@ -110,6 +113,12 @@
                     const XMLCh*             const content
                   ,       ValidationContext* const context = 0
                     );
  +
  +    virtual const XMLCh* getCanonicalRepresentation
  +                        (
  +                          const XMLCh*         const rawData
  +                        ,       MemoryManager* const memMgr = 0
  +                        ) const;
   
       /***
        * Support for Serialization/De-serialization
  
  
  
  1.8       +35 -1     xml-xerces/c/src/xercesc/validators/datatype/AbstractNumericValidator.cpp
  
  Index: AbstractNumericValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/datatype/AbstractNumericValidator.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractNumericValidator.cpp	12 Nov 2003 20:32:03 -0000	1.7
  +++ AbstractNumericValidator.cpp	28 Nov 2003 18:53:07 -0000	1.8
  @@ -57,6 +57,9 @@
   /*
    * $Id$
    * $Log$
  + * Revision 1.8  2003/11/28 18:53:07  peiyongz
  + * Support for getCanonicalRepresentation
  + *
    * Revision 1.7  2003/11/12 20:32:03  peiyongz
    * Statless Grammar: ValidationContext
    *
  @@ -184,6 +187,37 @@
          ThrowXML1(InvalidDatatypeValueException, XMLExcepts::RethrowError, e.getMessage());
       }
   
  +}
  +
  +/***
  + * 3.2.4 float
  + * 3.2.5 double
  + *
  + * . the exponent must be indicated by "E". 
  + *
  + * . For the mantissa, 
  + *      the preceding optional "+" sign is prohibited and 
  + *      the decimal point is required. 
  + *
  + * . For the exponent, 
  + *      the preceding optional "+" sign is prohibited. 
  + *      Leading zeroes are prohibited.
  + *      
  + * . Leading and trailing zeroes are prohibited subject to the following: 
  + *      number representations must be normalized such that 
  + *          . there is a single digit to the left of the decimal point and
  + *          . at least a single digit to the right of the decimal point.
  + *
  + ***/     
  +const XMLCh* AbstractNumericValidator::getCanonicalRepresentation(const XMLCh*         const rawData
  +                                                                 ,      MemoryManager* const memMgr) const
  +{
  +    AbstractNumericValidator* temp = (AbstractNumericValidator*) this;
  +    temp->checkContent(rawData, 0, false);
  +
  +    MemoryManager* toUse = memMgr? memMgr : fMemoryManager;
  +    //todo: change behaviour later
  +    return XMLString::replicate(rawData, toUse);
   }
   
   /***
  
  
  

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