knoaman 2004/09/28 17:07:40 Modified: c/src/xercesc/internal IGXMLScanner2.cpp SGXMLScanner.cpp Log: Fix for bug 1197. Disallow validating attributes when xsi:type is simple. Revision Changes Path 1.73 +9 -2 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.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- IGXMLScanner2.cpp 28 Sep 2004 21:27:38 -0000 1.72 +++ IGXMLScanner2.cpp 29 Sep 2004 00:07:40 -0000 1.73 @@ -83,8 +83,15 @@ // know what's best. REVISIT: don't modify grammar at all; eliminate // this step... ComplexTypeInfo *currType = 0; + DatatypeValidator *currDV = 0; if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType && fValidate) + { currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if (!currType) { + currDV = ((SchemaValidator*)fValidator)->getCurrentDatatypeValidator(); + } + } + const bool hasDefs = (currType && fValidate) ? currType->resetDefs() : elemDecl->resetDefs(); @@ -199,7 +206,7 @@ attDef = currType->getAttDef(suffPtr, uriId); attWildCard = currType->getAttWildCard(); } - else { // check explicitly-set wildcard + else if (!currDV) { // check explicitly-set wildcard attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard(); } 1.97 +13 -5 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.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- SGXMLScanner.cpp 27 Sep 2004 21:04:38 -0000 1.96 +++ SGXMLScanner.cpp 29 Sep 2004 00:07:40 -0000 1.97 @@ -2084,9 +2084,17 @@ // Ask the element to clear the 'provided' flag on all of the att defs // that it owns, and to return us a boolean indicating whether it has // any defs. - ComplexTypeInfo *currType = (fValidate) - ?((SchemaValidator*)fValidator)->getCurrentTypeInfo() - :0; + DatatypeValidator *currDV = 0; + ComplexTypeInfo *currType = 0; + + if (fValidate) + { + currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo(); + if (!currType) { + currDV = ((SchemaValidator*)fValidator)->getCurrentDatatypeValidator(); + } + } + const bool hasDefs = (currType && fValidate) ? currType->resetDefs() : elemDecl->resetDefs(); @@ -2191,7 +2199,7 @@ attDef = currType->getAttDef(suffPtr, uriId); attWildCard = currType->getAttWildCard(); } - else { // check explicitly-set wildcard + else if (!currDV) { // check explicitly-set wildcard attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard(); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]