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

cvs commit: xml-xerces/c/src/xercesc/validators/schema SchemaValidator.hpp

knoaman     2003/11/28 13:18:32

  Modified:    c/src/xercesc/framework/psvi PSVIElement.cpp PSVIElement.hpp
                        PSVIItem.cpp PSVIItem.hpp
               c/src/xercesc/internal IGXMLScanner.cpp SGXMLScanner.cpp
                        XMLScanner.hpp
               c/src/xercesc/validators/schema SchemaValidator.hpp
  Log:
  Make use of canonical representation in PSVIElement
  
  Revision  Changes    Path
  1.5       +10 -1     xml-xerces/c/src/xercesc/framework/psvi/PSVIElement.cpp
  
  Index: PSVIElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/PSVIElement.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PSVIElement.cpp	27 Nov 2003 22:52:37 -0000	1.4
  +++ PSVIElement.cpp	28 Nov 2003 21:18:31 -0000	1.5
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.5  2003/11/28 21:18:31  knoaman
  + * Make use of canonical representation in PSVIElement
  + *
    * Revision 1.4  2003/11/27 22:52:37  knoaman
    * PSVIElement implementation
    *
  @@ -87,6 +90,11 @@
   {
   }
   
  +PSVIElement::~PSVIElement()
  +{
  +    fMemoryManager->deallocate(fCanonicalValue);
  +}
  +
   XSTypeDefinition* PSVIElement::getTypeDefinition()
   {
       return fType;
  @@ -118,7 +126,7 @@
                          , XSModel* const                schemaInfo
                          , const XMLCh* const            defaultValue
                          , const XMLCh* const            normalizedValue
  -                       , const XMLCh* const            canonicalValue
  +                       , XMLCh* const                  canonicalValue
                          , XSNotationDeclaration* const  notationDecl)
   {
       fValidationContext = validationContext;
  @@ -132,6 +140,7 @@
       fSchemaInfo = schemaInfo;
       fDefaultValue = defaultValue;
       fNormalizedValue = normalizedValue;
  +    fMemoryManager->deallocate(fCanonicalValue);
       fCanonicalValue = canonicalValue;
   }
   
  
  
  
  1.6       +4 -2      xml-xerces/c/src/xercesc/framework/psvi/PSVIElement.hpp
  
  Index: PSVIElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/PSVIElement.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PSVIElement.hpp	27 Nov 2003 22:52:37 -0000	1.5
  +++ PSVIElement.hpp	28 Nov 2003 21:18:31 -0000	1.6
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.6  2003/11/28 21:18:31  knoaman
  + * Make use of canonical representation in PSVIElement
  + *
    * Revision 1.5  2003/11/27 22:52:37  knoaman
    * PSVIElement implementation
    *
  @@ -181,7 +184,7 @@
           , XSModel* const                schemaInfo
           , const XMLCh* const            defaultValue
           , const XMLCh* const            normalizedValue = 0
  -        , const XMLCh* const            canonicalValue = 0
  +        , XMLCh* const                  canonicalValue = 0
           , XSNotationDeclaration* const  notationDecl = 0
       );
   
  @@ -209,7 +212,6 @@
       XSNotationDeclaration *fNotationDecl;
       XSModel *fSchemaInfo;
   };
  -inline PSVIElement::~PSVIElement() {}
   
   inline XSElementDeclaration *PSVIElement::getElementDeclaration() 
   {
  
  
  
  1.5       +5 -1      xml-xerces/c/src/xercesc/framework/psvi/PSVIItem.cpp
  
  Index: PSVIItem.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/PSVIItem.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PSVIItem.cpp	25 Nov 2003 16:14:28 -0000	1.4
  +++ PSVIItem.cpp	28 Nov 2003 21:18:31 -0000	1.5
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.5  2003/11/28 21:18:31  knoaman
  + * Make use of canonical representation in PSVIElement
  + *
    * Revision 1.4  2003/11/25 16:14:28  neilg
    * move inlines into PSVIItem.hpp
    *
  @@ -81,6 +84,7 @@
           fValidationContext(0),
           fNormalizedValue(0),
           fDefaultValue(0),
  +        fCanonicalValue(0),
           fValidityState(VALIDITY_NOTKNOWN),
           fAssessmentType(VALIDATION_FULL),
           fIsSpecified(false),
  
  
  
  1.8       +7 -4      xml-xerces/c/src/xercesc/framework/psvi/PSVIItem.hpp
  
  Index: PSVIItem.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/PSVIItem.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PSVIItem.hpp	27 Nov 2003 17:58:59 -0000	1.7
  +++ PSVIItem.hpp	28 Nov 2003 21:18:31 -0000	1.8
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.8  2003/11/28 21:18:31  knoaman
  + * Make use of canonical representation in PSVIElement
  + *
    * Revision 1.7  2003/11/27 17:58:59  neilg
    * fix compilation error
    *
  @@ -249,7 +252,7 @@
        * was validated by a simple type definition for which canonical
        * representations of values are defined.
        */
  -    const XMLCh *getCanonicalRepresentation();
  +    const XMLCh *getCanonicalRepresentation() const;
   
       //@}
   
  @@ -311,7 +314,7 @@
       const XMLCh*                fValidationContext;
       const XMLCh*                fNormalizedValue;
       const XMLCh*                fDefaultValue;
  -    const XMLCh*                fCanonicalValue;
  +    XMLCh*                      fCanonicalValue;
       VALIDITY_STATE              fValidityState;
       ASSESSMENT_TYPE             fAssessmentType;
       bool                        fIsSpecified;
  @@ -336,7 +339,7 @@
       return fDefaultValue;
   }
   
  -inline const XMLCh* PSVIItem::getCanonicalRepresentation() 
  +inline const XMLCh* PSVIItem::getCanonicalRepresentation() const
   {
       return fCanonicalValue;
   }
  
  
  
  1.41      +23 -1     xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp
  
  Index: IGXMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- IGXMLScanner.cpp	28 Nov 2003 20:09:31 -0000	1.40
  +++ IGXMLScanner.cpp	28 Nov 2003 21:18:32 -0000	1.41
  @@ -1064,11 +1064,16 @@
           {
               fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
               fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo();
  +            fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue();
  +
  +            if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString))
  +                fPSVIElemContext.fNormalizedValue = 0;
           }
           else
           {
               fPSVIElemContext.fCurrentDV = 0;
               fPSVIElemContext.fCurrentTypeInfo = 0;
  +            fPSVIElemContext.fNormalizedValue = 0;
           }
       }
   
  @@ -2801,11 +2806,16 @@
               {
                   fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
                   fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo();
  +                fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue();
  +
  +                if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString))
  +                    fPSVIElemContext.fNormalizedValue = 0;
               }
               else
               {
                   fPSVIElemContext.fCurrentDV = 0;
                   fPSVIElemContext.fCurrentTypeInfo = 0;
  +                fPSVIElemContext.fNormalizedValue = 0;
               }
           }
   
  @@ -3349,6 +3359,15 @@
               ? (XSTypeDefinition*) fModel->getXSObject(fPSVIElemContext.fCurrentTypeInfo)
               : 0;
   
  +    XMLCh* canonicalValue = 0;
  +    if (fPSVIElemContext.fNormalizedValue)
  +    {
  +        if (memberDV)
  +            canonicalValue = (XMLCh*) memberDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager);
  +        else if (fPSVIElemContext.fCurrentDV)
  +            canonicalValue = (XMLCh*) fPSVIElemContext.fCurrentDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager);
  +    }
  +
       fPSVIElement->reset
       (
           validity
  @@ -3361,6 +3380,8 @@
           , (memberDV) ? (XSSimpleTypeDefinition*) fModel->getXSObject(memberDV) : 0
           , fModel
           , elemDecl->getDefaultValue()
  +        , fPSVIElemContext.fNormalizedValue
  +        , canonicalValue
       );
   
       fPSVIHandler->handleElementPSVI
  @@ -3387,6 +3408,7 @@
       fPSVIElemContext.fNoneValidationDepth = -1;
       fPSVIElemContext.fCurrentDV = 0;
       fPSVIElemContext.fCurrentTypeInfo = 0;
  +    fPSVIElemContext.fNormalizedValue = 0;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.60      +24 -1     xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp
  
  Index: SGXMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- SGXMLScanner.cpp	28 Nov 2003 20:20:54 -0000	1.59
  +++ SGXMLScanner.cpp	28 Nov 2003 21:18:32 -0000	1.60
  @@ -974,11 +974,17 @@
           {
               fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
               fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo();
  +            fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue();
  +
  +            if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString))
  +                fPSVIElemContext.fNormalizedValue = 0;
  +
           }
           else
           {
               fPSVIElemContext.fCurrentDV = 0;
               fPSVIElemContext.fCurrentTypeInfo = 0;
  +            fPSVIElemContext.fNormalizedValue = 0;
           }
       }
   
  @@ -1754,11 +1760,16 @@
               {
                   fPSVIElemContext.fCurrentDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
                   fPSVIElemContext.fCurrentTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo();
  +                fPSVIElemContext.fNormalizedValue = ((SchemaValidator*) fValidator)->getNormalizedValue();
  +
  +                if (XMLString::equals(fPSVIElemContext.fNormalizedValue, XMLUni::fgZeroLenString))
  +                    fPSVIElemContext.fNormalizedValue = 0;
               }
               else
               {
                   fPSVIElemContext.fCurrentDV = 0;
                   fPSVIElemContext.fCurrentTypeInfo = 0;
  +                fPSVIElemContext.fNormalizedValue = 0;
               }
           }
   
  @@ -4780,6 +4791,15 @@
               ? (XSTypeDefinition*) fModel->getXSObject(fPSVIElemContext.fCurrentTypeInfo)
               : 0;
   
  +    XMLCh* canonicalValue = 0;
  +    if (fPSVIElemContext.fNormalizedValue)
  +    {
  +        if (memberDV)
  +            canonicalValue = (XMLCh*) memberDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager);
  +        else if (fPSVIElemContext.fCurrentDV)
  +            canonicalValue = (XMLCh*) fPSVIElemContext.fCurrentDV->getCanonicalRepresentation(fPSVIElemContext.fNormalizedValue, fMemoryManager);
  +    }
  +
       fPSVIElement->reset
       (
           validity
  @@ -4792,6 +4812,8 @@
           , (memberDV) ? (XSSimpleTypeDefinition*) fModel->getXSObject(memberDV) : 0
           , fModel
           , elemDecl->getDefaultValue()
  +        , fPSVIElemContext.fNormalizedValue
  +        , canonicalValue
       );
   
       fPSVIHandler->handleElementPSVI
  @@ -4818,6 +4840,7 @@
       fPSVIElemContext.fNoneValidationDepth = -1;
       fPSVIElemContext.fCurrentDV = 0;
       fPSVIElemContext.fCurrentTypeInfo = 0;
  +    fPSVIElemContext.fNormalizedValue = 0;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.31      +4 -0      xml-xerces/c/src/xercesc/internal/XMLScanner.hpp
  
  Index: XMLScanner.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.hpp,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- XMLScanner.hpp	28 Nov 2003 19:54:31 -0000	1.30
  +++ XMLScanner.hpp	28 Nov 2003 21:18:32 -0000	1.31
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.31  2003/11/28 21:18:32  knoaman
  + * Make use of canonical representation in PSVIElement
  + *
    * Revision 1.30  2003/11/28 19:54:31  knoaman
    * PSVIElement update
    *
  @@ -336,6 +339,7 @@
       int                fNoneValidationDepth;
       DatatypeValidator* fCurrentDV;
       ComplexTypeInfo*   fCurrentTypeInfo;
  +    const XMLCh*       fNormalizedValue;
   };
   
   //  This is the mondo scanner class, which does the vast majority of the
  
  
  
  1.23      +9 -0      xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.hpp
  
  Index: SchemaValidator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.hpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SchemaValidator.hpp	27 Nov 2003 22:52:37 -0000	1.22
  +++ SchemaValidator.hpp	28 Nov 2003 21:18:32 -0000	1.23
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.23  2003/11/28 21:18:32  knoaman
  + * Make use of canonical representation in PSVIElement
  + *
    * Revision 1.22  2003/11/27 22:52:37  knoaman
    * PSVIElement implementation
    *
  @@ -272,6 +275,7 @@
       DatatypeValidator *getMostRecentAttrValidator() const;
       bool getErrorOccurred() const;
       bool getIsElemSpecified() const;
  +    const XMLCh* getNormalizedValue() const;
   
   private:
       // -----------------------------------------------------------------------
  @@ -532,6 +536,11 @@
   inline bool SchemaValidator::getIsElemSpecified() const
   {
       return fElemIsSpecified;
  +}
  +
  +inline const XMLCh* SchemaValidator::getNormalizedValue() const
  +{
  +    return fDatatypeBuffer.getRawBuffer();
   }
   
   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