neilg       2003/12/29 22:00:09

  Modified:    c/src/xercesc/internal IGXMLScanner2.cpp IGXMLScanner.cpp
                        SGXMLScanner.cpp
  Log:
  fix assorted PSVI bugs; also, initialize undeclared attribute registries appropriate 
to their local use
  
  Revision  Changes    Path
  1.55      +15 -15    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.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- IGXMLScanner2.cpp 20 Dec 2003 06:29:00 -0000      1.54
  +++ IGXMLScanner2.cpp 30 Dec 2003 06:00:09 -0000      1.55
  @@ -142,8 +142,6 @@
       // PSVI handling
       if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType )
           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;
  @@ -162,6 +160,8 @@
       unsigned int index;
       for (index = 0; index < attCount; index++)
       {
  +        PSVIItem::VALIDITY_STATE attrValid = PSVIItem::VALIDITY_VALID;
  +        PSVIItem::ASSESSMENT_TYPE attrAssessed = PSVIItem::VALIDATION_FULL;
           const KVStringPair* curPair = providedAttrs.elementAt(index);
   
           //  We have to split the name into its prefix and name parts. Then
  @@ -191,7 +191,7 @@
                   prefPtr = janName.get();
               }
   
  -            suffPtr = prefPtr + colonInd + 1;
  +            suffPtr = namePtr + colonInd + 1;
           }
           else
           {
  @@ -217,6 +217,7 @@
           //  do normal checking and processing.
           XMLAttDef::AttTypes attType;
           DatatypeValidator *attrValidator = 0;
  +        PSVIAttribute *psviAttr = 0;
           if (!isNSAttr || fGrammarType == Grammar::DTDGrammarType)
           {
               // Some checking for attribute wild card first (for schema)
  @@ -593,16 +594,15 @@
                   if(actualAttDef)
                   {
                        XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration 
*)fModel->getXSObject(actualAttDef);
  -                     PSVIAttribute *toFill = 
fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); 
  +                     psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, 
fURIStringPool->getValueForId(uriId)); 
                       DatatypeValidator * attrDataType = 
actualAttDef->getDatatypeValidator();
                        XSSimpleTypeDefinition *validatingType = 
(XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType);
                        if(attrValid != PSVIItem::VALIDITY_VALID)
                        {
  -                         toFill->reset(
  +                         psviAttr->reset(
                                fRootElemName
                                , attrValid
                                , attrAssessed
  -                             , normBuf.getRawBuffer()
                                , validatingType
                                , 0
                                , actualAttDef->getValue()
  @@ -616,11 +616,10 @@
                            XSSimpleTypeDefinition *memberType = 0;
                            if(validatingType->getVariety() == 
XSSimpleTypeDefinition::VARIETY_UNION)
                                memberType = (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator);
  -                         toFill->reset(
  +                         psviAttr->reset(
                                fRootElemName
                                , attrValid
                                , attrAssessed
  -                             , normBuf.getRawBuffer()
                                , validatingType
                                , memberType
                                , actualAttDef->getValue()
  @@ -647,16 +646,15 @@
                   attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI);
               if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType)
               {
  -                 PSVIAttribute *toFill = 
fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); 
  +                 psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, 
fURIStringPool->getValueForId(uriId)); 
                    XSSimpleTypeDefinition *validatingType = (attrValidator)
                               ? (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator)
                               : 0;
                   // no attribute declarations for these...
  -                 toFill->reset(
  +                 psviAttr->reset(
                        fRootElemName
                        , PSVIItem::VALIDITY_NOTKNOWN
                        , PSVIItem::VALIDATION_NONE
  -                    , normBuf.getRawBuffer()
                        , validatingType
                        , 0
                        , 0
  @@ -721,6 +719,8 @@
               );
               curAttr->setSpecified(true);
           }
  +        if(psviAttr)
  +            psviAttr->setValue(curAttr->getValue());
               
           // Bump the count of attrs in the list
           retCount++;
  @@ -851,7 +851,6 @@
                                   fRootElemName
                                   , PSVIItem::VALIDITY_INVALID
                                   , PSVIItem::VALIDATION_FULL
  -                                , curDef->getValue()
                                   , defAttrType
                                   , 0
                                   , curDef->getValue()
  @@ -874,7 +873,6 @@
                                   fRootElemName
                                   , PSVIItem::VALIDITY_VALID
                                   , PSVIItem::VALIDATION_FULL
  -                                , curDef->getValue()
                                   , defAttrType
                                   , defAttrMemberType
                                   , curDef->getValue()
  @@ -882,7 +880,8 @@
                                   , defAttrDecl
                                   , (defAttrMemberType)?((SchemaValidator 
*)fValidator)->getMostRecentAttrValidator():attrDataType
                               );
  -                        }
  +                        } 
  +                        defAttrToFill->setValue(curDef->getValue());
                       }
                   }
   
  @@ -1872,7 +1871,8 @@
           }
       }
       // fModel may need updating:
  -    if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType)
  +    if(getPSVIHandler())
  +    //&& fGrammarType == Grammar::SchemaGrammarType)
           fModel = fGrammarResolver->getXSModel();
   }
   
  
  
  
  1.55      +9 -3      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.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- IGXMLScanner.cpp  29 Dec 2003 16:07:55 -0000      1.54
  +++ IGXMLScanner.cpp  30 Dec 2003 06:00:09 -0000      1.55
  @@ -583,11 +583,11 @@
       );
       fUndeclaredAttrRegistry = new (fMemoryManager) RefHashTableOf<unsigned int>
       (
  -        131, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
  +        7, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
       );
       fUndeclaredAttrRegistryNS = new (fMemoryManager) RefHash2KeysTableOf<unsigned 
int>
       (
  -        131, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
  +        7, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
       );
       fPSVIAttrList = new (fMemoryManager) PSVIAttributeList(fMemoryManager);
   }
  @@ -1141,6 +1141,8 @@
               if (fPSVIHandler)
               {
                   fPSVIElemContext.fIsSpecified = ((SchemaValidator*) 
fValidator)->getIsElemSpecified();
  +                if(fPSVIElemContext.fIsSpecified)
  +                    fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl 
*)topElem->fThisElement)->getDefaultValue();
               }
   
               // call matchers and de-activate context
  @@ -2924,7 +2926,11 @@
                   else 
                   {
                       if (fPSVIHandler)
  +                    {
                           fPSVIElemContext.fIsSpecified = ((SchemaValidator*) 
fValidator)->getIsElemSpecified();
  +                        if(fPSVIElemContext.fIsSpecified)
  +                            fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl 
*)elemDecl)->getDefaultValue();
  +                    }
                       // note that if we're empty, won't be a current DV
                       if (fPSVIElemContext.fCurrentDV && 
fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union)
                           psviMemberType = 
fValidationContext->getValidatingMemberType();
  
  
  
  1.72      +24 -17    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.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- SGXMLScanner.cpp  29 Dec 2003 16:07:55 -0000      1.71
  +++ SGXMLScanner.cpp  30 Dec 2003 06:00:09 -0000      1.72
  @@ -1044,8 +1044,11 @@
           else if (fPSVIElemContext.fCurrentDV && 
fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union)
               psviMemberType = fValidationContext->getValidatingMemberType();
           if (fPSVIHandler)
  +        {
               fPSVIElemContext.fIsSpecified = ((SchemaValidator*) 
fValidator)->getIsElemSpecified();
  -
  +            if(fPSVIElemContext.fIsSpecified)
  +                fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl 
*)topElem->fThisElement)->getDefaultValue();
  +        }
           // call matchers and de-activate context
           int oldCount = fMatcherStack->getMatcherCount();
   
  @@ -1849,7 +1852,11 @@
               else 
               {
                   if (fPSVIHandler)
  +                {
                       fPSVIElemContext.fIsSpecified = ((SchemaValidator*) 
fValidator)->getIsElemSpecified();
  +                    if(fPSVIElemContext.fIsSpecified)
  +                        fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl 
*)elemDecl)->getDefaultValue();
  +                }
                   if (fPSVIElemContext.fCurrentDV && 
fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union)
                       psviMemberType = fValidationContext->getValidatingMemberType(); 
               }
  @@ -2215,7 +2222,7 @@
       );
       fUndeclaredAttrRegistryNS = new (fMemoryManager) RefHash2KeysTableOf<unsigned 
int>
       (
  -        131, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
  +        7, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
       );
       fPSVIAttrList = new (fMemoryManager) PSVIAttributeList(fMemoryManager);
   }
  @@ -2293,8 +2300,6 @@
       // 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;
  @@ -2313,6 +2318,8 @@
       unsigned int index;
       for (index = 0; index < attCount; index++)
       {
  +        PSVIItem::VALIDITY_STATE attrValid = PSVIItem::VALIDITY_VALID;
  +        PSVIItem::ASSESSMENT_TYPE attrAssessed = PSVIItem::VALIDATION_FULL;
           const KVStringPair* curPair = providedAttrs.elementAt(index);
   
           //  We have to split the name into its prefix and name parts. Then
  @@ -2342,7 +2349,7 @@
                   prefPtr = janName.get();
               }
   
  -            suffPtr = prefPtr + colonInd + 1;
  +            suffPtr = namePtr + colonInd + 1;
           }
           else
           {
  @@ -2368,6 +2375,7 @@
           //  do normal checking and processing.
           XMLAttDef::AttTypes attType;
           DatatypeValidator *attrValidator = 0;
  +        PSVIAttribute *psviAttr = 0;
           if (!isNSAttr)
           {
               // Some checking for attribute wild card first (for schema)
  @@ -2693,16 +2701,15 @@
                   if(actualAttDef)
                   {
                        XSAttributeDeclaration *attrDecl = (XSAttributeDeclaration 
*)fModel->getXSObject(actualAttDef);
  -                     PSVIAttribute *toFill = 
fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId));
  +                     psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, 
fURIStringPool->getValueForId(uriId));
                       DatatypeValidator * attrDataType = 
actualAttDef->getDatatypeValidator();
                        XSSimpleTypeDefinition *validatingType = 
(XSSimpleTypeDefinition *)fModel->getXSObject(attrDataType);
                        if(attrValid != PSVIItem::VALIDITY_VALID)
                        {
  -                         toFill->reset(
  +                         psviAttr->reset(
                                fRootElemName
                                , attrValid
                                , attrAssessed
  -                             , normBuf.getRawBuffer()
                                , validatingType
                                , 0
                                , actualAttDef->getValue()
  @@ -2716,11 +2723,10 @@
                            XSSimpleTypeDefinition *memberType = 0;
                            if(validatingType->getVariety() == 
XSSimpleTypeDefinition::VARIETY_UNION)
                                memberType = (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator);
  -                         toFill->reset(
  +                         psviAttr->reset(
                                fRootElemName
                                , attrValid
                                , attrAssessed
  -                             , normBuf.getRawBuffer()
                                , validatingType
                                , memberType
                                , actualAttDef->getValue()
  @@ -2747,16 +2753,15 @@
                   attrValidator = 
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYURI);
               if(getPSVIHandler())
               {
  -                PSVIAttribute *toFill = 
fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId));
  +                psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, 
fURIStringPool->getValueForId(uriId));
                    XSSimpleTypeDefinition *validatingType = (attrValidator)
                               ? (XSSimpleTypeDefinition 
*)fModel->getXSObject(attrValidator)
                               : 0;
                   // no attribute declarations for these...
  -                 toFill->reset(
  +                 psviAttr->reset(
                        fRootElemName
                        , PSVIItem::VALIDITY_NOTKNOWN
                        , PSVIItem::VALIDATION_NONE
  -                    , normBuf.getRawBuffer()
                        , validatingType
                        , 0
                        , 0
  @@ -2802,6 +2807,8 @@
               );
               curAttr->setSpecified(true);
           }
  +        if(psviAttr)
  +            psviAttr->setValue(curAttr->getValue());
   
           // Bump the count of attrs in the list
           retCount++;
  @@ -2913,7 +2920,6 @@
                                   fRootElemName
                                   , PSVIItem::VALIDITY_INVALID
                                   , PSVIItem::VALIDATION_FULL
  -                                , curDef->getValue()
                                   , defAttrType
                                   , 0
                                   , curDef->getValue()
  @@ -2932,11 +2938,11 @@
                                       
((SchemaValidator*)fValidator)->getMostRecentAttrValidator()
                                   );
                               }
  -                            defAttrToFill->reset(
  +                            defAttrToFill->reset
  +                            (
                                   fRootElemName
                                   , PSVIItem::VALIDITY_VALID
                                   , PSVIItem::VALIDATION_FULL
  -                                , curDef->getValue()
                                   , defAttrType
                                   , defAttrMemberType
                                   , curDef->getValue()
  @@ -2945,6 +2951,7 @@
                                   , (defAttrMemberType)?((SchemaValidator 
*)fValidator)->getMostRecentAttrValidator():attrDataType
                               );
                           }
  +                        defAttrToFill->setValue(curDef->getValue());
                       }
                   }
   
  
  
  

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

Reply via email to