You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2009/08/13 13:11:08 UTC
svn commit: r803844 - in /xerces/c/trunk/src/xercesc:
internal/IGXMLScanner.cpp internal/SGXMLScanner.cpp
internal/XSAXMLScanner.cpp validators/schema/SchemaValidator.hpp
Author: amassari
Date: Thu Aug 13 11:11:08 2009
New Revision: 803844
URL: http://svn.apache.org/viewvc?rev=803844&view=rev
Log:
When the xsi:type attribute is present, don't emit validation errors complaining of a missing declaration (XERCESC-1481)
Modified:
xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/XSAXMLScanner.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp
Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp?rev=803844&r1=803843&r2=803844&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp Thu Aug 13 11:11:08 2009
@@ -2402,6 +2402,7 @@
// We do something different here according to whether we found the
// element or not.
+ bool bXsiTypeSet= (fValidator && fGrammarType == Grammar::SchemaGrammarType)?((SchemaValidator*)fValidator)->getIsXsiTypeSet():false;
if (wasAdded)
{
if (laxThisOne) {
@@ -2416,15 +2417,19 @@
// faulted-in, was not an element in the grammar pool originally
elemDecl->setCreateReason(XMLElementDecl::JustFaultIn);
- fValidator->emitError
- (
- XMLValid::ElementNotDefined
- , elemDecl->getFullName()
- );
-
- if(fGrammarType == Grammar::SchemaGrammarType)
+ // xsi:type was specified, don't complain about missing definition
+ if(!bXsiTypeSet)
{
- fPSVIElemContext.fErrorOccurred = true;
+ fValidator->emitError
+ (
+ XMLValid::ElementNotDefined
+ , elemDecl->getFullName()
+ );
+
+ if(fGrammarType == Grammar::SchemaGrammarType)
+ {
+ fPSVIElemContext.fErrorOccurred = true;
+ }
}
}
}
@@ -2433,7 +2438,7 @@
// If its not marked declared and validating, then emit an error
if (!elemDecl->isDeclared()) {
if(elemDecl->getCreateReason() == XMLElementDecl::NoReason) {
- if(fGrammarType == Grammar::SchemaGrammarType) {
+ if(!bXsiTypeSet && fGrammarType == Grammar::SchemaGrammarType) {
fPSVIElemContext.fErrorOccurred = true;
}
}
@@ -2442,7 +2447,7 @@
fValidate = false;
fElemStack.setValidationFlag(fValidate);
}
- else if (fValidate)
+ else if (fValidate && !bXsiTypeSet)
{
fValidator->emitError
(
Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=803844&r1=803843&r2=803844&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Thu Aug 13 11:11:08 2009
@@ -1423,6 +1423,7 @@
// We do something different here according to whether we found the
// element or not.
+ bool bXsiTypeSet= (fValidator)?((SchemaValidator*)fValidator)->getIsXsiTypeSet():false;
if (wasAdded)
{
if (laxThisOne) {
@@ -1437,12 +1438,15 @@
// faulted-in, was not an element in the grammar pool originally
elemDecl->setCreateReason(XMLElementDecl::JustFaultIn);
- fValidator->emitError
- (
- XMLValid::ElementNotDefined
- , elemDecl->getFullName()
- );
- fPSVIElemContext.fErrorOccurred = true;
+ if(!bXsiTypeSet)
+ {
+ fValidator->emitError
+ (
+ XMLValid::ElementNotDefined
+ , elemDecl->getFullName()
+ );
+ fPSVIElemContext.fErrorOccurred = true;
+ }
}
}
else
@@ -1450,15 +1454,16 @@
// If its not marked declared and validating, then emit an error
if (!elemDecl->isDeclared()) {
if(elemDecl->getCreateReason() == XMLElementDecl::NoReason) {
- fPSVIElemContext.fErrorOccurred = true;
+ if(!bXsiTypeSet)
+ fPSVIElemContext.fErrorOccurred = true;
}
if (laxThisOne) {
fValidate = false;
fElemStack.setValidationFlag(fValidate);
}
- if (fValidate)
- {
+ if (fValidate && !bXsiTypeSet)
+ {
fValidator->emitError
(
XMLValid::ElementNotDefined
Modified: xerces/c/trunk/src/xercesc/internal/XSAXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XSAXMLScanner.cpp?rev=803844&r1=803843&r2=803844&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XSAXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XSAXMLScanner.cpp Thu Aug 13 11:11:08 2009
@@ -343,6 +343,7 @@
// We do something different here according to whether we found the
// element or not.
+ bool bXsiTypeSet= (fValidator)?((SchemaValidator*)fValidator)->getIsXsiTypeSet():false;
if (wasAdded || !elemDecl->isDeclared())
{
if (laxThisOne) {
@@ -357,10 +358,11 @@
// faulted-in, was not an element in the grammar pool originally
elemDecl->setCreateReason(XMLElementDecl::JustFaultIn);
- fValidator->emitError
- (
- XMLValid::ElementNotDefined, elemDecl->getFullName()
- );
+ if(!bXsiTypeSet)
+ fValidator->emitError
+ (
+ XMLValid::ElementNotDefined, elemDecl->getFullName()
+ );
}
}
Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp?rev=803844&r1=803843&r2=803844&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp Thu Aug 13 11:11:08 2009
@@ -134,6 +134,7 @@
DatatypeValidator *getMostRecentAttrValidator() const;
bool getErrorOccurred() const;
bool getIsElemSpecified() const;
+ bool getIsXsiTypeSet() const;
const XMLCh* getNormalizedValue() const;
private:
@@ -422,6 +423,11 @@
return fDatatypeBuffer.getRawBuffer();
}
+inline bool SchemaValidator::getIsXsiTypeSet() const
+{
+ return (fXsiType!=0);
+}
+
XERCES_CPP_NAMESPACE_END
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org