Return-Path: Delivered-To: apmail-xerces-commits-archive@www.apache.org Received: (qmail 54964 invoked from network); 20 May 2008 18:24:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 May 2008 18:24:41 -0000 Received: (qmail 81014 invoked by uid 500); 20 May 2008 18:24:42 -0000 Delivered-To: apmail-xerces-commits-archive@xerces.apache.org Received: (qmail 80993 invoked by uid 500); 20 May 2008 18:24:42 -0000 Mailing-List: contact commits-help@xerces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@xerces.apache.org Received: (qmail 80984 invoked by uid 99); 20 May 2008 18:24:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2008 11:24:42 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2008 18:24:04 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3814723889FF; Tue, 20 May 2008 11:24:20 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r658374 - in /xerces/c/branches/xerces-2/src/xercesc/validators/schema: GeneralAttributeCheck.cpp SchemaValidator.cpp SchemaValidator.hpp Date: Tue, 20 May 2008 18:24:19 -0000 To: commits@xerces.apache.org From: cargilld@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080520182420.3814723889FF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cargilld Date: Tue May 20 11:24:19 2008 New Revision: 658374 URL: http://svn.apache.org/viewvc?rev=658374&view=rev Log: Schema fixes for e1-16 errata and full schema checking of any choice restricted by any Modified: xerces/c/branches/xerces-2/src/xercesc/validators/schema/GeneralAttributeCheck.cpp xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.hpp Modified: xerces/c/branches/xerces-2/src/xercesc/validators/schema/GeneralAttributeCheck.cpp URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/schema/GeneralAttributeCheck.cpp?rev=658374&r1=658373&r2=658374&view=diff ============================================================================== --- xerces/c/branches/xerces-2/src/xercesc/validators/schema/GeneralAttributeCheck.cpp (original) +++ xerces/c/branches/xerces-2/src/xercesc/validators/schema/GeneralAttributeCheck.cpp Tue May 20 11:24:19 2008 @@ -794,7 +794,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/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp?rev=658374&r1=658373&r2=658374&view=diff ============================================================================== --- xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp (original) +++ xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp Tue May 20 11:24:19 2008 @@ -1211,6 +1211,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: @@ -1831,6 +1837,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/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.hpp URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.hpp?rev=658374&r1=658373&r2=658374&view=diff ============================================================================== --- xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.hpp (original) +++ xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.hpp Tue May 20 11:24:19 2008 @@ -211,6 +211,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