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 2004/09/26 20:23:50 UTC

cvs commit: xml-xerces/c/src/xercesc/internal IGXMLScanner2.cpp SGXMLScanner.cpp

knoaman     2004/09/26 11:23:50

  Modified:    c/src/xercesc/internal IGXMLScanner2.cpp SGXMLScanner.cpp
  Log:
  [Bug 1197] Validation of anyType elements fail when XML attributes present
  
  Revision  Changes    Path
  1.71      +11 -9     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.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- IGXMLScanner2.cpp	20 Sep 2004 15:00:50 -0000	1.70
  +++ IGXMLScanner2.cpp	26 Sep 2004 18:23:50 -0000	1.71
  @@ -182,21 +182,23 @@
               XMLAttDef* attDefForWildCard = 0;
               XMLAttDef*  attDef = 0;
   
  -            if (fGrammarType == Grammar::SchemaGrammarType && currType) {
  +            if (fGrammarType == Grammar::SchemaGrammarType) {
   
                   //retrieve the att def
  -                attDef = currType->getAttDef(suffPtr, uriId);
  +                SchemaAttDef* attWildCard;
  +                if (currType) {
  +                    attDef = currType->getAttDef(suffPtr, uriId);
  +                    attWildCard = currType->getAttWildCard();
  +                }
  +                else { // check explicitly-set wildcard
  +                    attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
  +                }
   
                   // if not found or faulted in - check for a matching wildcard attribute
                   // if no matching wildcard attribute, check (un)qualifed cases and flag
                   // appropriate errors
                   if (!attDef || (attDef->getCreateReason() == XMLAttDef::JustFaultIn)) {
   
  -                    SchemaAttDef* attWildCard = currType->getAttWildCard();
  -                    if(!attWildCard)
  -                        // check explicitly-set wildcard
  -                        attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
  -
                       if (attWildCard) {
                           //if schema, see if we should lax or skip the validation of this attribute
                           if (anyAttributeValidation(attWildCard, uriId, skipThisOne, laxThisOne)) {
  @@ -213,7 +215,7 @@
                               }
                           }
                       }
  -                    else {
  +                    else if (currType) {
                           // not found, see if the attDef should be qualified or not
                           if (uriId == fEmptyNamespaceId) {
                               attDef = currType->getAttDef(suffPtr
  
  
  
  1.95      +11 -9     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.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- SGXMLScanner.cpp	21 Sep 2004 16:10:47 -0000	1.94
  +++ SGXMLScanner.cpp	26 Sep 2004 18:23:50 -0000	1.95
  @@ -2183,21 +2183,23 @@
               XMLAttDef* attDefForWildCard = 0;
               XMLAttDef*  attDef = 0;
   
  -            if (fGrammarType == Grammar::SchemaGrammarType && currType) {
  +            if (fGrammarType == Grammar::SchemaGrammarType) {
   
                   //retrieve the att def
  -                attDef = currType->getAttDef(suffPtr, uriId);
  +                SchemaAttDef* attWildCard;
  +                if (currType) {
  +                    attDef = currType->getAttDef(suffPtr, uriId);
  +                    attWildCard = currType->getAttWildCard();
  +                }
  +                else { // check explicitly-set wildcard
  +                    attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
  +                }
   
                   // if not found or faulted in - check for a matching wildcard attribute
                   // if no matching wildcard attribute, check (un)qualifed cases and flag
                   // appropriate errors
                   if (!attDef || (attDef->getCreateReason() == XMLAttDef::JustFaultIn)) {
   
  -                    SchemaAttDef* attWildCard = currType->getAttWildCard();
  -                    if(!attWildCard)
  -                        // check explicitly-set wildcard
  -                        attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
  -
                       if (attWildCard) {
                           //if schema, see if we should lax or skip the validation of this attribute
                           if (anyAttributeValidation(attWildCard, uriId, skipThisOne, laxThisOne)) {
  @@ -2214,7 +2216,7 @@
                               }
                           }
                       }
  -                    else {
  +                    else if (currType) {
                           // not found, see if the attDef should be qualified or not
                           if (uriId == fEmptyNamespaceId) {
                               attDef = currType->getAttDef(suffPtr, fURIStringPool->getId(fGrammar->getTargetNamespace()));
  
  
  

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