diff --git a/src/xercesc/internal/IGXMLScanner.cpp b/src/xercesc/internal/IGXMLScanner.cpp index a43cbd0db3190de9a3e1cb9df5044277d7ce1f45..1ceee95206c75889c19622004f54f89ce1fde60d 100644 --- a/src/xercesc/internal/IGXMLScanner.cpp +++ b/src/xercesc/internal/IGXMLScanner.cpp @@ -1131,10 +1131,9 @@ void IGXMLScanner::scanEndTag(bool& gotData) } // reset xsi:type ComplexTypeInfo - if (fGrammarType == Grammar::SchemaGrammarType) { - // REVISIT XXX: should not be necessary + if (fGrammarType == Grammar::SchemaGrammarType) { ((SchemaElementDecl*)topElem->fThisElement)->reset(); - if (!isRoot && false) + if (!isRoot) ((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))-> setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo()); } @@ -2025,7 +2024,7 @@ bool IGXMLScanner::scanStartTag(bool& gotData) // This method is called to scan a start tag when we are processing // namespaces. There are two different versions of this method, one for -// namespace aware processing an done for non-namespace aware processing. +// namespace aware processing and one for non-namespace aware processing. // // This method is called after we've scanned the < of a start tag. So we // have to get the element name, then scan the attributes, after which @@ -2450,13 +2449,10 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) fValidate = false; fElemStack.setValidationFlag(fValidate); } - else if(fGrammarType == Grammar::SchemaGrammarType && fValidate) { - ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::FULL); - } - - // If validating then emit an error - if (fValidate) + else if (fValidate) { + // If validating then emit an error + // This is to tell the reuse Validator that this element was // faulted-in, was not an element in the grammar pool originally elemDecl->setCreateReason(XMLElementDecl::JustFaultIn); @@ -2468,7 +2464,16 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) ); if(fGrammarType == Grammar::SchemaGrammarType) - ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); + { + ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::FULL); + ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID);\ + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_FULL); + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } } else @@ -2477,6 +2482,12 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) if (fValidate) { ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::FULL); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::VALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_FULL); + // PSVIElement->setValidity(PSVIItem::VALIDITY_VALID); + } } } @@ -2486,6 +2497,12 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::FULL); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_FULL); + // PSVIElement->setValidity(PSVIItem::VALIDATION_INVALID); + } } } @@ -2493,7 +2510,7 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) fValidate = false; fElemStack.setValidationFlag(fValidate); } - if (fValidate) + else if (fValidate) { fValidator->emitError ( @@ -2502,9 +2519,8 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) ); } } - - // REVISIT: XXX not necessary - if (fGrammarType == Grammar::SchemaGrammarType && false) { + + if (fGrammarType == Grammar::SchemaGrammarType) { ((SchemaElementDecl*)elemDecl)->setXsiComplexTypeInfo(0); ((SchemaElementDecl*)elemDecl)->setXsiSimpleTypeInfo(0); } @@ -2512,6 +2528,11 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) if(errorBeforeElementFound && fGrammarType == Grammar::SchemaGrammarType) { ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } @@ -2550,16 +2571,21 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) ( XMLValid::GrammarNotFound , prefixBuf.getRawBuffer() - ); - - if(fGrammarType == Grammar::SchemaGrammarType) - ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); - + ); + ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } - else if(errorCondition) { - if(fGrammarType == Grammar::SchemaGrammarType) { - ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::NONE); - ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::UNKNOWN); + else if(errorCondition) { + ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::NONE); + ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::UNKNOWN); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_NONE); + // PSVIElement->setValidity(PSVIItem::VALIDITY_NOTKNOWN); } } } @@ -2594,8 +2620,14 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) fValidator->emitError(XMLValid::RootElemNotLikeDocType); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); - + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } } else if (parentValidation) @@ -2634,7 +2666,6 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) count = fMatcherStack->getMatcherCount(); for (unsigned int j = 0; j < count; j++) { - XPathMatcher* matcher = fMatcherStack->getMatcherAt(j); matcher->startElement(*elemDecl, uriId, fPrefixBuf.getRawBuffer(), *fAttrList, attCount); } @@ -2678,8 +2709,14 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) , elemDecl->getFormattedContentModel() ); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); - + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } if (fGrammarType == Grammar::SchemaGrammarType) { @@ -2735,7 +2772,6 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) if(!isRoot && fGrammarType == Grammar::SchemaGrammarType) ((SchemaElementDecl *)fElemStack.topElement()->fThisElement)->updateValidityFromElement(elemDecl, fGrammarType); - // If we have a doc handler, tell it about the end tag if (fDocHandler) { @@ -2749,10 +2785,9 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData) } // reset xsi:type ComplexTypeInfo - if (fGrammarType == Grammar::SchemaGrammarType) { - // REVISIT XXX: should not be necessary + if (fGrammarType == Grammar::SchemaGrammarType) { ((SchemaElementDecl*)elemDecl)->reset(); - if (!isRoot && false) + if (!isRoot) ((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))-> setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo()); } diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp index 9ca8a6040559448fab63a307b980b373e61fbe29..c2d54dbc545ae44544a2def7b3598d57cdfecebe 100644 --- a/src/xercesc/internal/IGXMLScanner2.cpp +++ b/src/xercesc/internal/IGXMLScanner2.cpp @@ -258,6 +258,11 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs ); if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -275,6 +280,11 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs ); if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -300,10 +310,20 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs if(!skipThisOne && fGrammarType == Grammar::SchemaGrammarType) { //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) + 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 (wasAdded) @@ -342,11 +362,22 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs ); if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } else if(errorCondition && laxThisOne && fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::NONE); ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::UNKNOWN); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_NOTKNOWN); + // PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE); + } } @@ -362,6 +393,11 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs ); if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } else @@ -554,6 +590,12 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs 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); + } } //the attributes is not provided @@ -570,7 +612,14 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs , curDef->getFullName() ); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaAttDef *)(curDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } else if ((defType == XMLAttDef::Default) || (defType == XMLAttDef::Fixed) ) @@ -581,7 +630,14 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // Document is standalone, so attributes must not be defaulted. fValidator->emitError(XMLValid::NoDefAttForStandalone, curDef->getFullName(), elemDecl->getFullName()); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaAttDef *)(curDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } } } @@ -648,6 +704,12 @@ IGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(curDef))->setValidity(PSVIDefs::INVALID); ((SchemaElementDecl *)elemDecl)->updateValidityFromAttribute((SchemaAttDef *)curDef); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + // new function? + } } } } @@ -721,13 +783,17 @@ bool IGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef // XML 1.0, Section 2.9 if (fStandalone && fValidate && isAttExternal) { - // Can't have a standalone document declaration of "yes" if attribute - // values are subject to normalisation - fValidator->emitError(XMLValid::NoAttNormForStandalone, attDef->getFullName()); - if(fGrammarType == Grammar::SchemaGrammarType) { - ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); - } - + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attDef->getFullName()); + if(fGrammarType == Grammar::SchemaGrammarType) { + ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } nextCh = chSpace; } @@ -768,6 +834,11 @@ bool IGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef fValidator->emitError(XMLValid::NoAttNormForStandalone, attDef->getFullName()); if(fGrammarType == Grammar::SchemaGrammarType) { ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -1073,7 +1144,14 @@ void IGXMLScanner::sendCharData(XMLBuffer& toSend) // They definitely cannot handle any type of char data fValidator->emitError(XMLValid::NoCharDataInCM); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } else if (fReaderMgr.getCurrentReader()->isAllSpaces(rawBuf, len)) { @@ -1166,7 +1244,14 @@ void IGXMLScanner::sendCharData(XMLBuffer& toSend) { fValidator->emitError(XMLValid::NoCharDataInCM); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } } } @@ -1998,12 +2083,17 @@ bool IGXMLScanner::scanAttValue( const XMLAttDef* const attDef // XML 1.0, Section 2.9 if (fStandalone && fValidate && isAttExternal) { - // Can't have a standalone document declaration of "yes" if attribute - // values are subject to normalisation - fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); - if(fGrammarType == Grammar::SchemaGrammarType) { - ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID); + if(fGrammarType == Grammar::SchemaGrammarType) { + ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } nextCh = chSpace; @@ -2147,7 +2237,14 @@ void IGXMLScanner::scanCDSection() // element type with element content whose element declaration was external fValidator->emitError(XMLValid::NoWSForStandalone); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } } } @@ -2186,6 +2283,11 @@ void IGXMLScanner::scanCDSection() // They definitely cannot handle any type of char data fValidator->emitError(XMLValid::NoCharDataInCM); ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } } @@ -2480,7 +2582,14 @@ void IGXMLScanner::scanCharData(XMLBuffer& toUse) // fValidator->emitError(XMLValid::NoWSForStandalone); if(fGrammarType == Grammar::SchemaGrammarType) + { ((SchemaElementDecl *)fElemStack.topElement()->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } + } } } } diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp index 3fc1232e0c25dfe01be463b593f674bdc286f926..e811a6ade3384413a848b42c58596d062db1d775 100644 --- a/src/xercesc/internal/SGXMLScanner.cpp +++ b/src/xercesc/internal/SGXMLScanner.cpp @@ -1059,12 +1059,9 @@ void SGXMLScanner::scanEndTag(bool& gotData) ); } - - // reset xsi:type ComplexTypeInfo - // REVISIT mutability! + // reset xsi:type ComplexTypeInfo ((SchemaElementDecl*)topElem->fThisElement)->reset(); - // XXX - if (!isRoot && false) + if (!isRoot) ((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))-> setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo()); @@ -1449,6 +1446,11 @@ bool SGXMLScanner::scanStartTag(bool& gotData) } else if(fValidate) { ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::FULL); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_FULL); + } } // If validating then emit an error @@ -1464,7 +1466,11 @@ bool SGXMLScanner::scanStartTag(bool& gotData) , elemDecl->getFullName() ); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); - + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } } else @@ -1473,6 +1479,12 @@ bool SGXMLScanner::scanStartTag(bool& gotData) if (fValidate) { ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::FULL); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::VALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_FULL); + // PSVIElement->setValidity(PSVIItem::VALIDITY_VALID); + } } } @@ -1481,6 +1493,12 @@ bool SGXMLScanner::scanStartTag(bool& gotData) if(elemDecl->getCreateReason() == XMLElementDecl::NoReason) { ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::FULL); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_FULL); + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } if (laxThisOne) { fValidate = false; @@ -1496,8 +1514,7 @@ bool SGXMLScanner::scanStartTag(bool& gotData) ); } } - - // XXX REVISIT: should not be necessary + ((SchemaElementDecl*)elemDecl)->setXsiComplexTypeInfo(0); ((SchemaElementDecl*)elemDecl)->setXsiSimpleTypeInfo(0); } @@ -1505,6 +1522,11 @@ bool SGXMLScanner::scanStartTag(bool& gotData) if(errorBeforeElementFound) { ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } // Now we can update the element stack to set the current element @@ -1544,12 +1566,22 @@ bool SGXMLScanner::scanStartTag(bool& gotData) , prefixBuf.getRawBuffer() ); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); - + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } else if(errorCondition) { ((SchemaElementDecl *)(elemDecl))->setValidationAttempted(PSVIDefs::NONE); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::UNKNOWN); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidationAttempted(PSVIItem::VALIDATION_FULL); + // PSVIElement->setValidity(PSVIItem::VALIDITY_NOTKNOWN); + } } } @@ -1576,6 +1608,11 @@ bool SGXMLScanner::scanStartTag(bool& gotData) if (fValidatorFromUser && !fValidator->checkRootElement(elemDecl->getId())) { fValidator->emitError(XMLValid::RootElemNotLikeDocType); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -1661,6 +1698,11 @@ bool SGXMLScanner::scanStartTag(bool& gotData) , elemDecl->getFormattedContentModel() ); ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } // call matchers and de-activate context @@ -1724,10 +1766,9 @@ bool SGXMLScanner::scanStartTag(bool& gotData) ); } - // reset xsi:type ComplexTypeInfo - // REVISIT XXX; should not be necessary + // reset xsi:type ComplexTypeInfo ((SchemaElementDecl*)elemDecl)->reset(); - if (!isRoot && false) + if (!isRoot) ((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))-> setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo()); @@ -2159,6 +2200,11 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs , attDef->getFullName() ); ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } else { @@ -2173,6 +2219,11 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs , attDef->getFullName() ); ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -2198,9 +2249,21 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs if(!skipThisOne && fGrammarType == Grammar::SchemaGrammarType) { //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); - + { + ((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 (wasAdded) @@ -2238,10 +2301,21 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs , elemDecl->getFullName() ); ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } else if(errorCondition && laxThisOne) { ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::NONE); ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::UNKNOWN); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE); + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_NOTKNOWN); + } } @@ -2256,6 +2330,11 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs , elemDecl->getFullName() ); ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } else @@ -2421,6 +2500,12 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs { ((SchemaAttDef *)curDef)->setValidationAttempted(PSVIDefs::FULL); ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::VALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_FULL); + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_VALID); + } //the attributes is not provided if (fValidate) @@ -2436,6 +2521,11 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs , curDef->getFullName() ); ((SchemaAttDef *)(curDef))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } else if ((defType == XMLAttDef::Default) || (defType == XMLAttDef::Fixed) ) @@ -2446,7 +2536,11 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs // 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); + } } } } @@ -2499,6 +2593,11 @@ SGXMLScanner::buildAttList(const RefVectorOf<KVStringPair>& providedAttrs , curDef->getFullName() ); ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } ((SchemaElementDecl *)elemDecl)->updateValidityFromAttribute((SchemaAttDef *)curDef); } @@ -2574,10 +2673,15 @@ bool SGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef // XML 1.0, Section 2.9 if (fStandalone && fValidate && isAttExternal) { - // Can't have a standalone document declaration of "yes" if attribute - // values are subject to normalisation - fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); - ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID); + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } nextCh = chSpace; } @@ -2613,10 +2717,15 @@ bool SGXMLScanner::normalizeAttValue( const XMLAttDef* const attDef { if (!firstNonWS || (nextCh != chSpace) || (!*srcPtr) || fReaderMgr.getCurrentReader()->isWhitespace(*srcPtr)) { - // Can't have a standalone document declaration of "yes" if attribute - // values are subject to normalisation - fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); - ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID); + // Can't have a standalone document declaration of "yes" if attribute + // values are subject to normalisation + fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName); + ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID); + } } } continue; @@ -2894,6 +3003,11 @@ void SGXMLScanner::sendCharData(XMLBuffer& toSend) // They definitely cannot handle any type of char data fValidator->emitError(XMLValid::NoCharDataInCM); ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } else if (fReaderMgr.getCurrentReader()->isAllSpaces(rawBuf, len)) { @@ -2978,6 +3092,11 @@ void SGXMLScanner::sendCharData(XMLBuffer& toSend) { fValidator->emitError(XMLValid::NoCharDataInCM); ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -3701,6 +3820,11 @@ void SGXMLScanner::scanCDSection() // element type with element content whose element declaration was external fValidator->emitError(XMLValid::NoWSForStandalone); ((SchemaElementDecl *)(topElem->fThisElement))->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -3737,6 +3861,11 @@ void SGXMLScanner::scanCDSection() // They definitely cannot handle any type of char data fValidator->emitError(XMLValid::NoCharDataInCM); ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } } @@ -4015,6 +4144,11 @@ void SGXMLScanner::scanCharData(XMLBuffer& toUse) // fValidator->emitError(XMLValid::NoWSForStandalone); ((SchemaElementDecl *)fElemStack.topElement()->fThisElement)->setValidity(PSVIDefs::INVALID); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID); + } } } } @@ -4267,6 +4401,11 @@ bool SGXMLScanner::anyAttributeValidation(SchemaAttDef* attWildCard, unsigned in // attribute should just be bypassed, skipThisOne = true; attWildCard->setValidationAttempted(PSVIDefs::NONE); + if (getPSVIHandler()) + { + // REVISIT: + // PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE); + } } else if (defType == XMLAttDef::ProcessContents_Lax) { laxThisOne = true;