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 2007/01/29 16:24:28 UTC
svn commit: r501079 -
/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp
Author: cargilld
Date: Mon Jan 29 07:24:27 2007
New Revision: 501079
URL: http://svn.apache.org/viewvc?view=rev&rev=501079
Log:
complextype restriction with substition group fix
Modified:
xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp
Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp?view=diff&rev=501079&r1=501078&r2=501079
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/SchemaValidator.cpp Mon Jan 29 07:24:27 2007
@@ -959,7 +959,7 @@
XMLCh nextCh;
const XMLCh* srcPtr = value;
XMLReader* fCurReader = getReaderMgr()->getCurrentReader();
-
+
if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing) {
nextCh = *srcPtr;
if (!fCurReader->isWhitespace(nextCh))
@@ -1425,14 +1425,6 @@
return;
}
- unsigned int baseURI = baseSpecNode->getElement()->getURI();
- const XMLCh* derivedName = derivedSpecNode->getElement()->getLocalPart();
- const XMLCh* baseName = baseSpecNode->getElement()->getLocalPart();
-
- if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI) {
- ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NameTypeOK1, fMemoryManager);
- }
-
SchemaGrammar* aGrammar = currentGrammar;
const XMLCh* schemaURI = fGrammarResolver->getStringPool()->getValueForId(derivedURI);
@@ -1443,6 +1435,8 @@
if (!aGrammar) { //something is wrong
return;
}
+
+ const XMLCh* derivedName = derivedSpecNode->getElement()->getLocalPart();
SchemaElementDecl* derivedElemDecl = findElement(derivedScope, derivedURI, derivedName, aGrammar);
@@ -1450,6 +1444,8 @@
return;
}
+ const XMLCh* baseName = baseSpecNode->getElement()->getLocalPart();
+ unsigned int baseURI = baseSpecNode->getElement()->getURI();
bool subsGroup = false;
if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI) {
@@ -1468,7 +1464,7 @@
}
subsGroup = true;
- }
+ }
if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(),
baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) {
@@ -1642,16 +1638,17 @@
ValueVectorOf<ContentSpecNode*>* const baseNodes,
const ComplexTypeInfo* const baseInfo) {
- ContentSpecNode::NodeTypes baseType = baseSpecNode->getType();
+ ContentSpecNode::NodeTypes baseType = baseSpecNode->getType();
bool toLax = false;
//Treat the element as if it were in a group of the same variety as base
ContentSpecNode derivedGroupNode(baseType, derivedSpecNodeIn, 0, false, true, fMemoryManager);
const ContentSpecNode* const derivedSpecNode = &derivedGroupNode;
-
+
if ((baseSpecNode->getType() & 0x0f) == ContentSpecNode::Choice) {
toLax = true;
}
+
// Instead of calling this routine, inline it
// checkRecurse(currentGrammar, &derivedGroupNode, derivedScope, &derivedNodes,
// baseSpecNode, baseScope, baseNodes, baseInfo, toLax);
@@ -1713,7 +1710,6 @@
if (codeToThrow != XMLExcepts::NoError) {
ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager);
}
-
}
void
@@ -1736,7 +1732,7 @@
XMLExcepts::Codes codeToThrow = XMLExcepts::NoError;
unsigned int count1= derivedNodes->size();
unsigned int count2= baseNodes->size();
- unsigned int current = 0;
+ unsigned int current = 0;
for (unsigned int i=0; i<count1; i++) {
@@ -1776,9 +1772,8 @@
// in case of Sequence or All
if (!toLax && codeToThrow == XMLExcepts::NoError) {
for (unsigned int j = current; j < count2; j++) {
- if (baseNodes->elementAt(j)->getMinTotalRange()) { //!emptiable
-
- codeToThrow = XMLExcepts::PD_Recurse2;
+ if (baseNodes->elementAt(j)->getMinTotalRange()) { //!emptiable
+ codeToThrow = XMLExcepts::PD_Recurse2;
break;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org