neilg       2003/11/26 22:10:32

  Modified:    c/src/xercesc/validators/schema SchemaValidator.cpp
                        SchemaValidator.hpp
               c/src/xercesc/internal XMLScanner.cpp IGXMLScanner.cpp
                        IGXMLScanner.hpp IGXMLScanner2.cpp SGXMLScanner.cpp
                        SGXMLScanner.hpp
               c/src/xercesc/framework/psvi PSVIAttribute.cpp
                        PSVIAttribute.hpp PSVIItem.hpp
  Log:
  PSVIAttribute implementation
  
  Revision  Changes    Path
  1.45      +12 -6     xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.cpp
  
  Index: SchemaValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.cpp,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- SchemaValidator.cpp       24 Nov 2003 05:13:20 -0000      1.44
  +++ SchemaValidator.cpp       27 Nov 2003 06:10:31 -0000      1.45
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.45  2003/11/27 06:10:31  neilg
  + * PSVIAttribute implementation
  + *
    * Revision 1.44  2003/11/24 05:13:20  neilg
    * expose validator that actually validated attribute.  Clean up union handling
    *
  @@ -577,6 +580,7 @@
       fCurrentDatatypeValidator = 0;
       fNil = false;
       fDatatypeBuffer.reset();
  +    fErrorOccurred = false;
   }
   
   bool SchemaValidator::requiresNamespaces() const
  @@ -590,6 +594,7 @@
                                          , const XMLElementDecl* elemDecl)
   {
   
  +    fErrorOccurred = false;
       //turn on IdRefList checking
       getScanner()->getValidationContext()->toCheckIdRefList(true);
   
  @@ -600,7 +605,6 @@
       //
       XMLAttDef::AttTypes            type      = attDef->getType();
       const XMLAttDef::DefAttTypes   defType   = attDef->getDefaultType();
  -    bool valid = true;
   
       //
       //  If the default type is fixed, then make sure the passed value maps
  @@ -615,7 +619,7 @@
           const XMLCh* const valueText = attDef->getValue();
           if (!XMLString::equals(attrValue, valueText)) {
               emitError(XMLValid::NotSameAsFixedValue, attDef->getFullName(), 
attrValue, valueText);
  -            valid = false;
  +            fErrorOccurred = true;
           }
       }
   
  @@ -627,13 +631,14 @@
           ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID);
           // accords with original DOMTypeInfo implementation, but this does not feel 
right.
           fMostRecentAttrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
  +        fErrorOccurred = true;
           return;
       }
   
       DatatypeValidator* attDefDV = ((SchemaAttDef*) attDef)->getDatatypeValidator();
       if (!attDefDV) {
           emitError(XMLValid::NoDatatypeValidatorForAttribute, attDef->getFullName());
  -        valid = false;
  +        fErrorOccurred = true;
       }
       else {
           DatatypeValidator::ValidatorType attDefDVType = attDefDV->getType();
  @@ -668,7 +673,7 @@
   
           }
           catch (XMLException& idve) {
  -            valid = false;
  +            fErrorOccurred = true;
               emitError (XMLValid::DatatypeError, idve.getType(), idve.getMessage()); 
      
           }
           catch(const OutOfMemoryException&)
  @@ -680,6 +685,7 @@
               ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID);
               ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID);
               fMostRecentAttrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
  +            fErrorOccurred = true;
               throw;
           } 
           fMostRecentAttrValidator = attDefDV;
  @@ -734,7 +740,7 @@
                       XMLValid::MultipleIdAttrs
                       , elemDecl->getFullName()
                   );
  -                valid = false;
  +                fErrorOccurred = true;
               }
               else
                   fSeenId = true;
  @@ -742,7 +748,7 @@
   
       }
   
  -    if(!valid) {
  +    if(fErrorOccurred) {
           ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID);
           ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID);
           fMostRecentAttrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
  
  
  
  1.21      +12 -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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SchemaValidator.hpp       24 Nov 2003 05:13:20 -0000      1.20
  +++ SchemaValidator.hpp       27 Nov 2003 06:10:31 -0000      1.21
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.21  2003/11/27 06:10:31  neilg
  + * PSVIAttribute implementation
  + *
    * Revision 1.20  2003/11/24 05:13:20  neilg
    * expose validator that actually validated attribute.  Clean up union handling
    *
  @@ -264,6 +267,7 @@
       ComplexTypeInfo* getCurrentTypeInfo() const;
       DatatypeValidator *getCurrentDatatypeValidator() const;
       DatatypeValidator *getMostRecentAttrValidator() const;
  +    bool getErrorOccurred();
   
   private:
       // -----------------------------------------------------------------------
  @@ -397,6 +401,8 @@
       //      Stack of complex type declarations.
       //  fMostRecentAttrValidator
       //      DatatypeValidator that validated attribute most recently processed
  +    //  fErrorOccurred
  +    //      whether an error occurred in the most recent operation
       // -----------------------------------------------------------------------
       MemoryManager*                  fMemoryManager;
       SchemaGrammar*                  fSchemaGrammar;
  @@ -411,6 +417,7 @@
       XSDErrorReporter                fSchemaErrorReporter;
       ValueStackOf<ComplexTypeInfo*>* fTypeStack;
       DatatypeValidator *             fMostRecentAttrValidator;
  +    bool                            fErrorOccurred;
   };
   
   
  @@ -508,6 +515,11 @@
           return true;
       }
       return false;
  +}
  +
  +inline bool SchemaValidator::getErrorOccurred()
  +{
  +    return fErrorOccurred;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.55      +2 -0      xml-xerces/c/src/xercesc/internal/XMLScanner.cpp
  
  Index: XMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.cpp,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- XMLScanner.cpp    24 Nov 2003 05:09:38 -0000      1.54
  +++ XMLScanner.cpp    27 Nov 2003 06:10:31 -0000      1.55
  @@ -228,6 +228,7 @@
       , fUIntPoolRow(0)
       , fUIntPoolCol(0)
       , fUIntPoolRowTotal(2)
  +    , fPSVIHandler(0)
   {
      commonInit();
   
  @@ -303,6 +304,7 @@
       , fUIntPoolRow(0)
       , fUIntPoolCol(0)
       , fUIntPoolRowTotal(2)
  +    , fPSVIHandler(0)
   {
      commonInit();
   
  
  
  
  1.35      +20 -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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- IGXMLScanner.cpp  26 Nov 2003 16:20:00 -0000      1.34
  +++ IGXMLScanner.cpp  27 Nov 2003 06:10:31 -0000      1.35
  @@ -74,6 +74,7 @@
   #include <xercesc/framework/MemoryManager.hpp>
   #include <xercesc/framework/XMLGrammarPool.hpp>
   #include <xercesc/framework/XMLDTDDescription.hpp>
  +#include <xercesc/framework/psvi/PSVIHandler.hpp>
   #include <xercesc/validators/common/GrammarResolver.hpp>
   #include <xercesc/validators/DTD/DocTypeHandler.hpp>
   #include <xercesc/validators/DTD/DTDScanner.hpp>
  @@ -113,6 +114,7 @@
       , fAttDefRegistry(0)
       , fUndeclaredAttrRegistry(0)
       , fUndeclaredAttrRegistryNS(0)
  +    , fPSVIAttrList(0)
       , fModel(0)
   {
       try
  @@ -160,6 +162,7 @@
       , fAttDefRegistry(0)
       , fUndeclaredAttrRegistry(0)
       , fUndeclaredAttrRegistryNS(0)
  +    , fPSVIAttrList(0)
       , fModel(0)
   {
       try
  @@ -578,6 +581,7 @@
       (
           509, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
       );
  +    fPSVIAttrList = new (fMemoryManager) PSVIAttributeList(fMemoryManager);
   }
   
   void IGXMLScanner::cleanUp()
  @@ -595,6 +599,7 @@
       delete fAttDefRegistry;
       delete fUndeclaredAttrRegistry;
       delete fUndeclaredAttrRegistryNS;
  +    delete fPSVIAttrList;
   }
   
   // ---------------------------------------------------------------------------
  @@ -2711,6 +2716,20 @@
               , attCount
               , false
               , isRoot
  +        );
  +    }
  +
  +    // if we have a PSVIHandler, now's the time to call
  +    // its handleAttributesPSVI method:
  +    if(fPSVIHandler)
  +    {
  +        QName *eName = elemDecl->getElementName();
  +        fPSVIHandler->handleAttributesPSVI
  +        (
  +            eName->getLocalPart()
  +            , fURIStringPool->getValueForId(eName->getURI())
  +            , eName->getPrefix()
  +            , fPSVIAttrList
           );
       }
   
  
  
  
  1.14      +10 -1     xml-xerces/c/src/xercesc/internal/IGXMLScanner.hpp
  
  Index: IGXMLScanner.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- IGXMLScanner.hpp  26 Nov 2003 16:20:00 -0000      1.13
  +++ IGXMLScanner.hpp  27 Nov 2003 06:10:31 -0000      1.14
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.14  2003/11/27 06:10:31  neilg
  + * PSVIAttribute implementation
  + *
    * Revision 1.13  2003/11/26 16:20:00  knoaman
    * Store XSModel.
    *
  @@ -108,6 +111,8 @@
   #include <xercesc/util/RefHash3KeysIdPool.hpp>
   #include <xercesc/validators/common/Grammar.hpp>
   #include <xercesc/validators/schema/SchemaElementDecl.hpp>
  +#include <xercesc/framework/psvi/PSVIAttribute.hpp>
  +#include <xercesc/framework/psvi/PSVIAttributeList.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -343,6 +348,9 @@
       // fUndeclaredAttrRegistryNS
       //      mapping of namespaceId/localName pairs to the count of the last
       //      start tag in which they occurred.
  +    //  fPSVIAttrList
  +    //      PSVI attribute list implementation that needs to be
  +    //      filled when a PSVIHandler is registered
       //
       // -----------------------------------------------------------------------
       bool                        fSeeXsi;
  @@ -364,6 +372,7 @@
       RefHashTableOf<unsigned int>*           fAttDefRegistry;
       RefHashTableOf<unsigned int>*           fUndeclaredAttrRegistry;
       RefHash2KeysTableOf<unsigned int>*      fUndeclaredAttrRegistryNS;
  +    PSVIAttributeList *                     fPSVIAttrList;
       XSModel*                                fModel;
   };
   
  
  
  
  1.43      +162 -75   xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp
  
  Index: IGXMLScanner2.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- IGXMLScanner2.cpp 24 Nov 2003 05:09:38 -0000      1.42
  +++ IGXMLScanner2.cpp 27 Nov 2003 06:10:31 -0000      1.43
  @@ -80,6 +80,9 @@
   #include <xercesc/framework/XMLGrammarPool.hpp>
   #include <xercesc/framework/XMLDTDDescription.hpp>
   #include <xercesc/framework/XMLSchemaDescription.hpp>
  +#include <xercesc/framework/psvi/PSVIAttribute.hpp>
  +#include <xercesc/framework/psvi/XSAttributeDeclaration.hpp>
  +#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
   #include <xercesc/validators/common/ContentLeafNameTypeVector.hpp>
   #include <xercesc/validators/DTD/DTDGrammar.hpp>
   #include <xercesc/validators/DTD/DTDValidator.hpp>
  @@ -137,6 +140,12 @@
       if (!hasDefs && !attCount)
           return 0;
   
  +    // PSVI handling
  +    if(fGrammarType == Grammar::SchemaGrammarType && getPSVIHandler())
  +        fPSVIAttrList->reset();
  +    PSVIItem::VALIDITY_STATE attrValid = PSVIItem::VALIDITY_VALID;
  +    PSVIItem::ASSESSMENT_TYPE attrAssessed = PSVIItem::VALIDATION_FULL;
  +
       // Keep up with how many attrs we end up with total
       unsigned int retCount = 0;
   
  @@ -221,7 +230,6 @@
               if (fGrammarType == Grammar::SchemaGrammarType && currType) {
   
                   //retrieve the att def
  -                // currType must be non-null for schema grammars
                   attDef = currType->getAttDef(suffPtr, uriId);
   
                   // if not found or faulted in - check for a matching wildcard 
attribute
  @@ -265,8 +273,7 @@
                                       ((SchemaAttDef 
*)(attDef))->setValidity(PSVIDefs::INVALID);
                                       if (getPSVIHandler())
                                       {
  -                                        // REVISIT:                                 
  
  -                                        // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  +                                        attrValid = PSVIItem::VALIDITY_INVALID;
                                       }                                
                                   }
                               }
  @@ -287,8 +294,7 @@
                                       ((SchemaAttDef 
*)(attDef))->setValidity(PSVIDefs::INVALID);
                                       if (getPSVIHandler())
                                       {
  -                                        // REVISIT:                                 
  
  -                                        // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  +                                        attrValid = PSVIItem::VALIDITY_INVALID;
                                       }
                                   }
                               }
  @@ -379,17 +385,26 @@
                   //we may have set it to invalid already, but this is the first time 
we are guarenteed to have the attDef
                   if(((SchemaAttDef *)(attDef))->getValidity() != PSVIDefs::INVALID)  
           
                       ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::VALID);
  -                // REVISIT: need to check getValidity...
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:                                   
  -                    // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  -                }                    
                   ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::FULL);
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:                                   
  -                    // 
PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_FULL);
  +            }
  +            if(getPSVIHandler())
  +            {
  +                // if we've found either an attDef or an attDefForWildCard,
  +                // then we're doing full validation and it may still be valid.
  +                if(!attDef && !attDefForWildCard)
  +                {
  +                    if(!laxThisOne && !skipThisOne)
  +                        attrValid = PSVIItem::VALIDITY_INVALID;
  +                    else if(laxThisOne)
  +                    {
  +                        attrValid = PSVIItem::VALIDITY_NOTKNOWN;
  +                        attrAssessed = PSVIItem::VALIDATION_PARTIAL;
  +                    }
  +                    else
  +                    {
  +                        attrValid = PSVIItem::VALIDITY_NOTKNOWN;
  +                        attrAssessed = PSVIItem::VALIDATION_NONE;
  +                    }
                   }
               }
   
  @@ -421,51 +436,13 @@
                   );
                   if(fGrammarType == Grammar::SchemaGrammarType && attDef) {
                       ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID);
  -                    if (getPSVIHandler())
  -                    {
  -                        // REVISIT:                                   
  -                        // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  -                    }
                   }
               }
               else if(errorCondition && laxThisOne && fGrammarType == 
Grammar::SchemaGrammarType && attDef) {
                   ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::NONE);
                   ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::UNKNOWN);
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:                                   
  -                    // PSVIAttribute->setValidity(PSVIItem::VALIDITY_NOTKNOWN);
  -                    // 
PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE);
  -                }
               }
   
  -
  -            /**** REVISIT:  excise this dead code
  -            //  If its already provided, then there are more than one of
  -            //  this attribute in this start tag, so emit an error.
  -            if (attDef->getProvided())
  -            {
  -                emitError
  -                ( 
  -                    XMLErrs::AttrAlreadyUsedInSTag
  -                    , attDef->getFullName()
  -                    , elemDecl->getFullName()
  -                );
  -                if(fGrammarType == Grammar::SchemaGrammarType) {
  -                    ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID);
  -                    if (getPSVIHandler())
  -                    {
  -                        // REVISIT:                                   
  -                        // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);  
                     
  -                    }
  -                }
  -            }
  -            else
  -            {
  -                attDef->setProvided(true);
  -            }
  -            ********/
  -
               //  Now normalize the raw value since we have the attribute type. We
               //  don't care about the return status here. If it failed, an error
               //  was issued, which is all we care about.
  @@ -504,6 +481,8 @@
                           , elemDecl
                       );
                       attrValidator = 
((SchemaValidator*)fValidator)->getMostRecentAttrValidator();
  +                    if(getPSVIHandler() && ((SchemaValidator 
*)fValidator)->getErrorOccurred())
  +                        attrValid = PSVIItem::VALIDITY_INVALID;
                   }
                   else // no decl; default DOMTypeInfo to anySimpleType
                       attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
  @@ -555,6 +534,8 @@
                               , elemDecl
                           );
                           attrValidator = 
((SchemaValidator*)fValidator)->getMostRecentAttrValidator();
  +                        if(getPSVIHandler() && ((SchemaValidator 
*)fValidator)->getErrorOccurred())
  +                            attrValid = PSVIItem::VALIDITY_INVALID;
                       }
                       else if(fGrammarType == Grammar::SchemaGrammarType)
                           attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
  @@ -576,7 +557,53 @@
   
   
               }
  -        }
  +
  +            // now fill in the PSVIAttributes entry for this attribute:
  +             if(getPSVIHandler())
  +             {
  +                 SchemaAttDef *actualAttDef = 0;
  +                 if(attDef)
  +                     actualAttDef = (SchemaAttDef *)attDef;
  +                 else if (attDefForWildCard)
  +                     actualAttDef = (SchemaAttDef *)attDefForWildCard;
  +                 XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration 
*)fModel->getXSObject(actualAttDef);
  +                 PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); 
  +                 XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition 
*)fModel->getXSObject(actualAttDef->getDatatypeValidator());
  +                 if(attrValid != PSVIItem::VALIDITY_VALID)
  +                 {
  +                     toFill->reset(
  +                         fRootElemName
  +                         , attrValid
  +                         , attrAssessed
  +                         , normBuf.getRawBuffer()
  +                         , validatingType
  +                         , 0
  +                         , actualAttDef->getValue()
  +                         , false
  +                         , 0
  +                         , attrDecl
  +                     );
  +                 }
  +                 else
  +                 {
  +                     XSSimpleTypeDefinition *memberType = 0;
  +                     if(validatingType->getVariety() == 
XSSimpleTypeDefinition::VARIETY_UNION)
  +                         memberType = (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator);
  +                     toFill->reset(
  +                         fRootElemName
  +                         , attrValid
  +                         , attrAssessed
  +                         , normBuf.getRawBuffer()
  +                         , validatingType
  +                         , memberType
  +                         , actualAttDef->getValue()
  +                         , false
  +                         , 0
  +                         , attrDecl
  +                     );
  +                 }
  +             }
  +         }
           else
           {
               // Just normalize as CDATA
  @@ -590,6 +617,26 @@
               if((uriId == fXMLNSNamespaceId)
                     || XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI))
                   attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI);
  +            if(getPSVIHandler())
  +            {
  +                 PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); 
  +                 XSSimpleTypeDefinition *validatingType = (attrValidator)
  +                            ? (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator)
  +                            : 0;
  +                // no attribute declarations for these...
  +                 toFill->reset(
  +                     fRootElemName
  +                     , PSVIItem::VALIDITY_NOTKNOWN
  +                     , PSVIItem::VALIDATION_NONE
  +                    , normBuf.getRawBuffer()
  +                     , validatingType
  +                     , 0
  +                     , 0
  +                    , false
  +                     , 0
  +                     , 0
  +                );
  +            }
           }
   
           //  Add this attribute to the attribute list that we use to pass them
  @@ -675,13 +722,10 @@
                   if(fGrammarType == Grammar::SchemaGrammarType) {
                       ((SchemaAttDef 
*)curDef)->setValidationAttempted(PSVIDefs::FULL);
                       ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::VALID);
  -                    if (getPSVIHandler())
  -                    {
  -                        // REVISIT:                                   
  -                        // PSVIAttribute->setValidity(PSVIItem::VALIDITY_VALID;
  -                        // 
PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_FULL);
  -                    }
                   }
  +                // note that since there is no attribute information
  +                // item present, there is no PSVI infoset to augment here *except*
  +                // that the element is invalid
   
                   //the attribute is not provided
                   if (fValidate)
  @@ -699,11 +743,6 @@
                           if(fGrammarType == Grammar::SchemaGrammarType) 
                           {
                               ((SchemaAttDef 
*)(curDef))->setValidity(PSVIDefs::INVALID);
  -                            if (getPSVIHandler())
  -                            {
  -                                // REVISIT:                                   
  -                                // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);                                
  -                            }
                           }
                       }
                       else if ((defType == XMLAttDef::Default) ||
  @@ -717,11 +756,6 @@
                               if(fGrammarType == Grammar::SchemaGrammarType)
                               {
                                   ((SchemaAttDef 
*)(curDef))->setValidity(PSVIDefs::INVALID);
  -                                if (getPSVIHandler())
  -                                {
  -                                    // REVISIT:                                   
  -                                    // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);                   
  -                                }
                               }
                           }
                       }
  @@ -769,6 +803,52 @@
                       // Indicate it was not explicitly specified and bump count
                       curAtt->setSpecified(false);
                       retCount++;
  +                    if(getPSVIHandler())
  +                    {
  +                        PSVIAttribute *defAttrToFill = 
fPSVIAttrList->getPSVIAttributeToFill();
  +                        XSAttributeDeclaration *defAttrDecl = 
(XSAttributeDeclaration *)fModel->getXSObject((void *)curDef);
  +                        XSSimpleTypeDefinition *defAttrType = 
  +                            
(XSSimpleTypeDefinition*)fModel->getXSObject(((SchemaAttDef 
*)curDef)->getDatatypeValidator());
  +                        // would have occurred during validation of default value
  +                        if(((SchemaValidator *)fValidator)->getErrorOccurred())
  +                        {
  +                            defAttrToFill->reset(
  +                                fRootElemName
  +                                , PSVIItem::VALIDITY_INVALID
  +                                , PSVIItem::VALIDATION_FULL
  +                                , curDef->getValue()
  +                                , defAttrType
  +                                , 0
  +                                , curDef->getValue()
  +                                , true 
  +                                , 0
  +                                , defAttrDecl
  +                            );
  +                        }
  +                        else
  +                        {
  +                            XSSimpleTypeDefinition *defAttrMemberType = 0;
  +                            if(defAttrType->getVariety() == 
XSSimpleTypeDefinition::VARIETY_UNION)
  +                            {
  +                                defAttrMemberType = (XSSimpleTypeDefinition 
*)fModel->getXSObject
  +                                (
  +                                    
((SchemaValidator*)fValidator)->getMostRecentAttrValidator()
  +                                );
  +                            }
  +                            defAttrToFill->reset(
  +                                fRootElemName
  +                                , PSVIItem::VALIDITY_VALID
  +                                , PSVIItem::VALIDATION_FULL
  +                                , curDef->getValue()
  +                                , defAttrType
  +                                , defAttrMemberType
  +                                , curDef->getValue()
  +                                , true
  +                                , 0
  +                                , defAttrDecl
  +                            );
  +                        }
  +                    }
                   }
   
                   if(fGrammarType == Grammar::SchemaGrammarType)
  @@ -779,20 +859,27 @@
               {
                   //attribute is provided
                   // (schema) report error for PROHIBITED attrs that are present 
(V_TAGc)
  -                if (defType == XMLAttDef::Prohibited && fValidate) {
  +                if (defType == XMLAttDef::Prohibited && fValidate) 
  +                {
                       fValidator->emitError
                       (
                           XMLValid::ProhibitedAttributePresent
                           , curDef->getFullName()
                       );
  -                    if(fGrammarType == Grammar::SchemaGrammarType) {
  +                    if(fGrammarType == Grammar::SchemaGrammarType) 
  +                    {
                           ((SchemaAttDef *)(curDef))->setValidity(PSVIDefs::INVALID);
                           ((SchemaElementDecl 
*)elemDecl)->updateValidityFromAttribute((SchemaAttDef *)curDef);
                           if (getPSVIHandler())
                           {
  -                            // REVISIT:                                   
  -                            // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  -                            // new function?                            
  +                            QName *attQName = ((SchemaAttDef 
*)curDef)->getAttName();
  +                            // bad luck...
  +                            PSVIAttribute *prohibitedAttr = 
fPSVIAttrList->getAttributePSVIByName
  +                            (
  +                                attQName->getLocalPart(), 
  +                                fURIStringPool->getValueForId(attQName->getURI())
  +                            );
  +                            
prohibitedAttr->updateValidity(PSVIItem::VALIDITY_INVALID);
                           }
                       }
                   }
  
  
  
  1.52      +180 -72   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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- SGXMLScanner.cpp  26 Nov 2003 16:20:00 -0000      1.51
  +++ SGXMLScanner.cpp  27 Nov 2003 06:10:31 -0000      1.52
  @@ -73,6 +73,10 @@
   #include <xercesc/framework/MemoryManager.hpp>
   #include <xercesc/framework/XMLGrammarPool.hpp>
   #include <xercesc/framework/XMLSchemaDescription.hpp>
  +#include <xercesc/framework/psvi/PSVIHandler.hpp>
  +#include <xercesc/framework/psvi/PSVIAttribute.hpp>
  +#include <xercesc/framework/psvi/XSAttributeDeclaration.hpp>
  +#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
   #include <xercesc/internal/EndOfEntityException.hpp>
   #include <xercesc/validators/common/ContentLeafNameTypeVector.hpp>
   #include <xercesc/validators/schema/SchemaValidator.hpp>
  @@ -114,6 +118,7 @@
       , fElemCount(0)
       , fAttDefRegistry(0)
       , fUndeclaredAttrRegistryNS(0)
  +    , fPSVIAttrList(0)
       , fModel(0)
   {
       try
  @@ -164,6 +169,7 @@
       , fElemCount(0)
       , fAttDefRegistry(0)
       , fUndeclaredAttrRegistryNS(0)
  +    , fPSVIAttrList(0)
       , fModel(0)
   {
       try
  @@ -1684,6 +1690,20 @@
           );
       } // may be where we output something...
   
  +    // if we have a PSVIHandler, now's the time to call
  +    // its handleAttributesPSVI method:
  +    if(fPSVIHandler)
  +    {
  +        QName *eName = elemDecl->getElementName();
  +        fPSVIHandler->handleAttributesPSVI
  +        (
  +            eName->getLocalPart()
  +            , fURIStringPool->getValueForId(eName->getURI())
  +            , eName->getPrefix()
  +            , fPSVIAttrList
  +        );
  +    }
  +
       //  If empty, validate content right now if we are validating and then
       //  pop the element stack top. Else, we have to update the current stack
       //  top's namespace mapping elements.
  @@ -2032,6 +2052,7 @@
       (
           509, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
       );
  +    fPSVIAttrList = new (fMemoryManager) PSVIAttributeList(fMemoryManager);
   }
   
   void SGXMLScanner::cleanUp()
  @@ -2047,6 +2068,7 @@
       delete fElemNonDeclPool;
       delete fAttDefRegistry;
       delete fUndeclaredAttrRegistryNS;
  +    delete fPSVIAttrList;
   }
   
   void SGXMLScanner::resizeElemState() {
  @@ -2099,6 +2121,12 @@
       if (!hasDefs && !attCount)
           return 0;
   
  +    // PSVI handling
  +    if(getPSVIHandler())
  +        fPSVIAttrList->reset();
  +    PSVIItem::VALIDITY_STATE attrValid = PSVIItem::VALIDITY_VALID;
  +    PSVIItem::ASSESSMENT_TYPE attrAssessed = PSVIItem::VALIDATION_FULL;
  +
       // Keep up with how many attrs we end up with total
       unsigned int retCount = 0;
   
  @@ -2224,8 +2252,7 @@
                                   ((SchemaAttDef 
*)(attDef))->setValidity(PSVIDefs::INVALID);
                                   if (getPSVIHandler())
                                   {
  -                                    // REVISIT:                
  -                                    // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  +                                    attrValid = PSVIItem::VALIDITY_INVALID;
                                   }
                               }
                           }
  @@ -2243,8 +2270,7 @@
                                   ((SchemaAttDef 
*)(attDef))->setValidity(PSVIDefs::INVALID);
                                   if (getPSVIHandler())
                                   {
  -                                    // REVISIT:                
  -                                    // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  +                                    attrValid = PSVIItem::VALIDITY_INVALID;
                                   }
                               }
                           }
  @@ -2308,17 +2334,27 @@
                   {
                       ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::VALID);       
         
                   }   
  -                // REVISIT: need to check out value...
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:                
  -                    // PSVIAttribute->setValidity(PSVIItem::VALIDITY_VALID);
  -                }
                   ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::FULL);
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:
  -                    // 
PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_FULL);
  +            }
  +
  +            if(getPSVIHandler())
  +            {
  +                // if we've found either an attDef or an attDefForWildCard,
  +                // then we're doing full validation and it may still be valid.
  +                if(!attDef && !attDefForWildCard)
  +                {
  +                    if(!laxThisOne && !skipThisOne)
  +                        attrValid = PSVIItem::VALIDITY_INVALID;
  +                    else if(laxThisOne)
  +                    {
  +                        attrValid = PSVIItem::VALIDITY_NOTKNOWN;
  +                        attrAssessed = PSVIItem::VALIDATION_PARTIAL;
  +                    }
  +                    else
  +                    {
  +                        attrValid = PSVIItem::VALIDITY_NOTKNOWN;
  +                        attrAssessed = PSVIItem::VALIDATION_NONE;
  +                    }
                   }
               }
   
  @@ -2350,49 +2386,12 @@
                   );
                   if(attDef)
                       ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID);
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:                
  -                    // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  -                }
               }
               else if(errorCondition && laxThisOne && attDef) {
                   ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::NONE);
                   ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::UNKNOWN);
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:
  -                    // 
PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE);
  -                    // PSVIAttribute->setValidity(PSVIItem::VALIDITY_NOTKNOWN);
  -                }
               }
   
  -
  -            /**** REVISIT:  excise this dead code
  -            //  If its already provided, then there are more than one of
  -            //  this attribute in this start tag, so emit an error.
  -            if (attDef->getProvided())
  -            {
  -                emitError
  -                (
  -                    XMLErrs::AttrAlreadyUsedInSTag
  -                    , attDef->getFullName()
  -                    , elemDecl->getFullName()
  -                );
  -                ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID);
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:                
  -                    // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  -                }
  -
  -            }
  -            else
  -            {
  -                attDef->setProvided(true);
  -            }
  -            *******/
  -
               //  Now normalize the raw value since we have the attribute type. We
               //  don't care about the return status here. If it failed, an error
               //  was issued, which is all we care about.
  @@ -2431,6 +2430,8 @@
                           , elemDecl
                       );
                       attrValidator = ((SchemaValidator 
*)fValidator)->getMostRecentAttrValidator();
  +                    if(getPSVIHandler() && ((SchemaValidator 
*)fValidator)->getErrorOccurred())
  +                        attrValid = PSVIItem::VALIDITY_INVALID;
                   }
                   else // no decl; default DOMTypeInfo to anySimpleType
                       attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
  @@ -2481,6 +2482,8 @@
                               , elemDecl
                           );
                           attrValidator = ((SchemaValidator 
*)fValidator)->getMostRecentAttrValidator();
  +                        if(getPSVIHandler() && ((SchemaValidator 
*)fValidator)->getErrorOccurred())
  +                            attrValid = PSVIItem::VALIDITY_INVALID;
                       }
                       else
                           attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
  @@ -2495,6 +2498,52 @@
                       ((SchemaElementDecl 
*)(elemDecl))->updateValidityFromAttribute((SchemaAttDef *)attDef);
                   } 
               }
  +
  +            // now fill in the PSVIAttributes entry for this attribute:
  +             if(getPSVIHandler())
  +             {
  +                 SchemaAttDef *actualAttDef = 0;
  +                 if(attDef)
  +                     actualAttDef = (SchemaAttDef *)attDef;
  +                 else if (attDefForWildCard)
  +                     actualAttDef = (SchemaAttDef *)attDefForWildCard;
  +                 XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration 
*)fModel->getXSObject(actualAttDef);
  +                 PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); 
  +                 XSSimpleTypeDefinition *validatingType = (XSSimpleTypeDefinition 
*)fModel->getXSObject(actualAttDef->getDatatypeValidator());
  +                 if(attrValid != PSVIItem::VALIDITY_VALID)
  +                 {
  +                     toFill->reset(
  +                         fRootElemName
  +                         , attrValid
  +                         , attrAssessed
  +                         , normBuf.getRawBuffer()
  +                         , validatingType
  +                         , 0
  +                         , actualAttDef->getValue()
  +                         , false
  +                         , 0
  +                         , attrDecl
  +                     );
  +                 }
  +                 else
  +                 {
  +                     XSSimpleTypeDefinition *memberType = 0;
  +                     if(validatingType->getVariety() == 
XSSimpleTypeDefinition::VARIETY_UNION)
  +                         memberType = (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator);
  +                     toFill->reset(
  +                         fRootElemName
  +                         , attrValid
  +                         , attrAssessed
  +                         , normBuf.getRawBuffer()
  +                         , validatingType
  +                         , memberType
  +                         , actualAttDef->getValue()
  +                         , false
  +                         , 0
  +                         , attrDecl
  +                     );
  +                 }
  +             }
           }
           else
           {
  @@ -2509,9 +2558,28 @@
               if((uriId == fXMLNSNamespaceId)
                     || XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI))
                   attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI);
  +            if(getPSVIHandler())
  +            {
  +                 PSVIAttribute *toFill = fPSVIAttrList->getPSVIAttributeToFill(); 
  +                 XSSimpleTypeDefinition *validatingType = (attrValidator)
  +                            ? (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator)
  +                            : 0;
  +                // no attribute declarations for these...
  +                 toFill->reset(
  +                     fRootElemName
  +                     , PSVIItem::VALIDITY_NOTKNOWN
  +                     , PSVIItem::VALIDATION_NONE
  +                    , normBuf.getRawBuffer()
  +                     , validatingType
  +                     , 0
  +                     , 0
  +                    , false
  +                     , 0
  +                     , 0
  +                );
  +            }
           }
   
  -
           //  Add this attribute to the attribute list that we use to pass them
           //  to the handler. We reuse its existing elements but expand it as
           //  required.
  @@ -2575,12 +2643,9 @@
               { // did not occur
                   ((SchemaAttDef *)curDef)->setValidationAttempted(PSVIDefs::FULL);
                   ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::VALID);
  -                if (getPSVIHandler())
  -                {
  -                    // REVISIT:
  -                    // 
PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_FULL);
  -                    // PSVIAttribute->setValidity(PSVIItem::VALIDITY_VALID);
  -                }
  +                // note that since there is no attribute information
  +                // item present, there is no PSVI infoset to augment here *except*
  +                // that the element is invalid
   
                   //the attribute is not provided
                   if (fValidate)
  @@ -2596,11 +2661,6 @@
                               , curDef->getFullName()
                           );
                           ((SchemaAttDef *)(curDef))->setValidity(PSVIDefs::INVALID);
  -                        if (getPSVIHandler())
  -                        {
  -                            // REVISIT:                
  -                            // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  -                        }
                       }
                       else if ((defType == XMLAttDef::Default) ||
                                (defType == XMLAttDef::Fixed)  )
  @@ -2611,11 +2671,6 @@
                               // Document is standalone, so attributes must not be 
defaulted.
                               fValidator->emitError(XMLValid::NoDefAttForStandalone, 
curDef->getFullName(), elemDecl->getFullName());
                               ((SchemaAttDef 
*)(curDef))->setValidity(PSVIDefs::INVALID);
  -                            if (getPSVIHandler())
  -                            {
  -                                // REVISIT:                
  -                                // 
PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  -                            }
                           }
                       }
                   }
  @@ -2652,6 +2707,52 @@
                       // Indicate it was not explicitly specified and bump count
                       curAtt->setSpecified(false);
                       retCount++;
  +                    if(getPSVIHandler())
  +                    {
  +                        PSVIAttribute *defAttrToFill = 
fPSVIAttrList->getPSVIAttributeToFill();
  +                        XSAttributeDeclaration *defAttrDecl = 
(XSAttributeDeclaration *)fModel->getXSObject((void *)curDef);
  +                        XSSimpleTypeDefinition *defAttrType = 
  +                            
(XSSimpleTypeDefinition*)fModel->getXSObject(((SchemaAttDef 
*)curDef)->getDatatypeValidator());
  +                        // would have occurred during validation of default value
  +                        if(((SchemaValidator *)fValidator)->getErrorOccurred())
  +                        {
  +                            defAttrToFill->reset(
  +                                fRootElemName
  +                                , PSVIItem::VALIDITY_INVALID
  +                                , PSVIItem::VALIDATION_FULL
  +                                , curDef->getValue()
  +                                , defAttrType
  +                                , 0
  +                                , curDef->getValue()
  +                                , true 
  +                                , 0
  +                                , defAttrDecl
  +                            );
  +                        }
  +                        else
  +                        {
  +                            XSSimpleTypeDefinition *defAttrMemberType = 0;
  +                            if(defAttrType->getVariety() == 
XSSimpleTypeDefinition::VARIETY_UNION)
  +                            {
  +                                defAttrMemberType = (XSSimpleTypeDefinition 
*)fModel->getXSObject
  +                                (
  +                                    
((SchemaValidator*)fValidator)->getMostRecentAttrValidator()
  +                                );
  +                            }
  +                            defAttrToFill->reset(
  +                                fRootElemName
  +                                , PSVIItem::VALIDITY_VALID
  +                                , PSVIItem::VALIDATION_FULL
  +                                , curDef->getValue()
  +                                , defAttrType
  +                                , defAttrMemberType
  +                                , curDef->getValue()
  +                                , true
  +                                , 0
  +                                , defAttrDecl
  +                            );
  +                        }
  +                    }
                   }
   
                   ((SchemaElementDecl 
*)elemDecl)->updateValidityFromAttribute((SchemaAttDef *)curDef);
  @@ -2660,7 +2761,8 @@
               {
                   //attribute is provided
                   // (schema) report error for PROHIBITED attrs that are present 
(V_TAGc)
  -                if (defType == XMLAttDef::Prohibited && fValidate) {
  +                if (defType == XMLAttDef::Prohibited && fValidate) 
  +                {
                       fValidator->emitError
                       (
                           XMLValid::ProhibitedAttributePresent
  @@ -2669,8 +2771,14 @@
                       ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::INVALID);       
  
                       if (getPSVIHandler())
                       {
  -                        // REVISIT:               
  -                        // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
  +                        QName *attQName = ((SchemaAttDef *)curDef)->getAttName();
  +                        // bad luck...
  +                        PSVIAttribute *prohibitedAttr = 
fPSVIAttrList->getAttributePSVIByName
  +                        (
  +                            attQName->getLocalPart(), 
  +                            fURIStringPool->getValueForId(attQName->getURI())
  +                        );
  +                        prohibitedAttr->updateValidity(PSVIItem::VALIDITY_INVALID);
                       }
                   }
                   ((SchemaElementDecl 
*)elemDecl)->updateValidityFromAttribute((SchemaAttDef *)curDef);
  
  
  
  1.13      +10 -2     xml-xerces/c/src/xercesc/internal/SGXMLScanner.hpp
  
  Index: SGXMLScanner.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SGXMLScanner.hpp  26 Nov 2003 16:20:00 -0000      1.12
  +++ SGXMLScanner.hpp  27 Nov 2003 06:10:31 -0000      1.13
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.13  2003/11/27 06:10:31  neilg
  + * PSVIAttribute implementation
  + *
    * Revision 1.12  2003/11/26 16:20:00  knoaman
    * Store XSModel.
    *
  @@ -105,6 +108,8 @@
   #include <xercesc/util/RefHash3KeysIdPool.hpp>
   #include <xercesc/validators/common/Grammar.hpp>
   #include <xercesc/validators/schema/SchemaElementDecl.hpp>
  +#include <xercesc/framework/psvi/PSVIAttribute.hpp>
  +#include <xercesc/framework/psvi/PSVIAttributeList.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -327,7 +332,9 @@
       // fUndeclaredAttrRegistryNS
       //      mapping of namespaceId/localName pairs to the count of the last
       //      start tag in which they occurred.
  -    //
  +    //  fPSVIAttrList
  +    //      PSVI attribute list implementation that needs to be
  +    //      filled when a PSVIHandler is registered
       //
       // -----------------------------------------------------------------------
       bool                        fSeeXsi;
  @@ -346,6 +353,7 @@
       unsigned int                            fElemCount;
       RefHashTableOf<unsigned int>*           fAttDefRegistry;
       RefHash2KeysTableOf<unsigned int>*      fUndeclaredAttrRegistryNS;
  +    PSVIAttributeList *                     fPSVIAttrList;
       XSModel*                                fModel;
   };
   
  
  
  
  1.3       +28 -0     xml-xerces/c/src/xercesc/framework/psvi/PSVIAttribute.cpp
  
  Index: PSVIAttribute.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/PSVIAttribute.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PSVIAttribute.cpp 6 Nov 2003 21:50:33 -0000       1.2
  +++ PSVIAttribute.cpp 27 Nov 2003 06:10:32 -0000      1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/11/27 06:10:32  neilg
  + * PSVIAttribute implementation
  + *
    * Revision 1.2  2003/11/06 21:50:33  neilg
    * fix compilation errors under gcc 3.3.
    *
  @@ -72,6 +75,31 @@
           PSVIItem(manager),
           fAttributeDecl(0)
   {
  +}
  +
  +void PSVIAttribute::reset(
  +            const XMLCh * const         valContext
  +            , PSVIItem::VALIDITY_STATE  state
  +            , PSVIItem::ASSESSMENT_TYPE assessmentType
  +            , const XMLCh * const       normalizedValue
  +            , XSSimpleTypeDefinition *  validatingType
  +            , XSSimpleTypeDefinition *  memberType
  +            , const XMLCh * const       defaultValue
  +            , const bool                isSpecified
  +            , const XMLCh * const       canonicalValue
  +            , XSAttributeDeclaration *  attrDecl
  +        )
  +{
  +    fValidationContext = valContext;
  +    fValidityState = state;
  +    fAssessmentType = assessmentType;
  +    fNormalizedValue = normalizedValue;
  +    fType = validatingType;
  +    fMemberType = memberType;
  +    fDefaultValue = defaultValue;
  +    fIsSpecified = isSpecified;
  +    fCanonicalValue = canonicalValue;
  +    fAttributeDecl = attrDecl;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.4       +34 -2     xml-xerces/c/src/xercesc/framework/psvi/PSVIAttribute.hpp
  
  Index: PSVIAttribute.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/PSVIAttribute.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PSVIAttribute.hpp 6 Nov 2003 21:50:33 -0000       1.3
  +++ PSVIAttribute.hpp 27 Nov 2003 06:10:32 -0000      1.4
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2003/11/27 06:10:32  neilg
  + * PSVIAttribute implementation
  + *
    * Revision 1.3  2003/11/06 21:50:33  neilg
    * fix compilation errors under gcc 3.3.
    *
  @@ -71,6 +74,7 @@
   #define PSVIATTRIBUTE_HPP
   
   #include <xercesc/framework/psvi/PSVIItem.hpp>
  +#include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -145,6 +149,29 @@
   
       //@{
   
  +    /**
  +      * reset this object.  Intended to be called by
  +      * the implementation.
  +      */
  +    void reset(
  +            const XMLCh * const         valContext
  +            , PSVIItem::VALIDITY_STATE  state
  +            , PSVIItem::ASSESSMENT_TYPE assessmentType
  +            , const XMLCh * const       normalizedValue
  +            , XSSimpleTypeDefinition *  validatingType
  +            , XSSimpleTypeDefinition *  memberType
  +            , const XMLCh * const       defaultValue
  +            , const bool                isSpecified
  +            , const XMLCh * const       canonicalValue
  +            , XSAttributeDeclaration *  attrDecl
  +        );
  +
  +    /**
  +      * set VALIDITY_STATE to specified value; intended to be
  +      * called by implementation.
  +      */
  +    void updateValidity(VALIDITY_STATE newValue);
  +
       //@}
   
   private:
  @@ -160,8 +187,8 @@
       //  data members
       // -----------------------------------------------------------------------
       // fAttributeDecl
  -    //  attribute declaration component that validated this attribute 
  -    XSAttributeDeclaration *fAttributeDecl;
  +    //      attribute declaration component that validated this attribute 
  +    XSAttributeDeclaration *    fAttributeDecl;
   };
   inline PSVIAttribute::~PSVIAttribute() {}
   
  @@ -178,6 +205,11 @@
   inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition() 
   {
       return fMemberType;
  +}
  +
  +inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue)
  +{
  +    fValidityState = newValue;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.5       +10 -6     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PSVIItem.hpp      25 Nov 2003 16:14:28 -0000      1.4
  +++ PSVIItem.hpp      27 Nov 2003 06:10:32 -0000      1.5
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.5  2003/11/27 06:10:32  neilg
  + * PSVIAttribute implementation
  + *
    * Revision 1.4  2003/11/25 16:14:28  neilg
    * move inlines into PSVIItem.hpp
    *
  @@ -286,6 +289,8 @@
       //  The schema normalized value (when present)
       // fDefaultValue
       //  default value specified in the schema, if any
  +    // fCanonicalValue
  +    //  canonicalized version of normalizedValue
       // fValidityState
       //  Whether this item is valid or not
       // fAssessmentType
  @@ -293,30 +298,30 @@
       // fIsSpecified
       //  Whether this item exists because a default was specified in the schema
       // fType
  -    //  Type definition that validated this item
  +    //  type responsible for validating this item
       // fMemberType
       //  If fType is a union type, the member type that validated this item
       MemoryManager* const        fMemoryManager;
       const XMLCh*                fValidationContext;
       const XMLCh*                fNormalizedValue;
       const XMLCh*                fDefaultValue;
  +    const XMLCh*                fCanonicalValue;
       VALIDITY_STATE              fValidityState;
       ASSESSMENT_TYPE             fAssessmentType;
       bool                        fIsSpecified;
  -    XSTypeDefinition*           fType;
  +    XSTypeDefinition *          fType;
       XSSimpleTypeDefinition*     fMemberType;
   };
  +
   inline PSVIItem::~PSVIItem() {}
   
   inline const XMLCh *PSVIItem::getValidationContext() 
   {
  -    // REVISIT
       return fValidationContext;
   }
   
   inline const XMLCh* PSVIItem::getSchemaNormalizedValue() 
   {
  -    // REVISIT
       return fNormalizedValue;
   }
   
  @@ -327,8 +332,7 @@
   
   inline const XMLCh* PSVIItem::getCanonicalRepresentation() 
   {
  -    // REVISIT
  -    return 0;
  +    return fCanonicalValue;
   }
   
   inline PSVIItem::VALIDITY_STATE PSVIItem::getValidity() const
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to