You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2008/05/20 20:27:27 UTC
svn commit: r658378 - in /xerces/c/trunk/src/xercesc/validators/schema:
GeneralAttributeCheck.cpp SchemaValidator.cpp SchemaValidator.hpp
Author: cargilld
Date: Tue May 20 11:27:27 2008
New Revision: 658378
URL: http://svn.apache.org/viewvc?rev=658378&view=rev
Log:
Schema fixes for e1-16 errata and full schema checking of any choice restricted by any
Modified:
xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp
Modified: xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp?rev=658378&r1=658377&r2=658378&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/GeneralAttributeCheck.cpp Tue May 20 11:27:27 2008
@@ -736,7 +736,7 @@
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp?rev=658378&r1=658377&r2=658378&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Tue May 20 11:27:27 2008
@@ -1212,6 +1212,12 @@
case ContentSpecNode::All:
case ContentSpecNode::Leaf:
{
+ if (baseNodeType == ContentSpecNode::Any_NS_Choice) {
+ if (checkNSSubsetChoiceRoot(curSpecNode, baseSpecNode)) {
+ return;
+ }
+ }
+
ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_ForbiddenRes1, fMemoryManager);
}
default:
@@ -1832,6 +1838,45 @@
}
}
+bool SchemaValidator::checkNSSubsetChoiceRoot(const ContentSpecNode* const derivedSpecNode,
+ const ContentSpecNode* const baseSpecNode) {
+ bool found = false;
+
+ if (baseSpecNode->getType() == ContentSpecNode::Any_NS_Choice) {
+ const ContentSpecNode* first = baseSpecNode->getFirst();
+ const ContentSpecNode* second = baseSpecNode->getSecond();
+
+ if (first) {
+ found = checkNSSubsetChoiceRoot(derivedSpecNode, first);
+ if (found) return true;
+ }
+ if (second) {
+ found = checkNSSubsetChoiceRoot(derivedSpecNode, second);
+ if (found) return true;
+ }
+ }
+ else { // should be Any_NS
+ found = checkNSSubsetChoice(derivedSpecNode, baseSpecNode);
+ }
+
+ return found;
+}
+
+bool SchemaValidator::checkNSSubsetChoice(const ContentSpecNode* const derivedSpecNode,
+ const ContentSpecNode* const baseSpecNode) {
+
+ // check Occurrence ranges
+ if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(),
+ baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) {
+ return false;
+ }
+
+ if (!isWildCardEltSubset(derivedSpecNode, baseSpecNode)) {
+ return false;
+ }
+ return true;
+}
+
bool
SchemaValidator::isWildCardEltSubset(const ContentSpecNode* const derivedSpecNode,
const ContentSpecNode* const baseSpecNode) {
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=658378&r1=658377&r2=658378&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.hpp Tue May 20 11:27:27 2008
@@ -209,6 +209,10 @@
const bool toLax = false);
void checkNSSubset(const ContentSpecNode* const derivedSpecNode,
const ContentSpecNode* const baseSpecNode);
+ bool checkNSSubsetChoiceRoot(const ContentSpecNode* const derivedSpecNode,
+ const ContentSpecNode* const baseSpecNode);
+ bool checkNSSubsetChoice(const ContentSpecNode* const derivedSpecNode,
+ const ContentSpecNode* const baseSpecNode);
bool isWildCardEltSubset(const ContentSpecNode* const derivedSpecNode,
const ContentSpecNode* const baseSpecNode);
void checkNSRecurseCheckCardinality(SchemaGrammar* const currentGrammar,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org