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:25:47 UTC
svn commit: r501080 -
/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
Author: cargilld
Date: Mon Jan 29 07:25:46 2007
New Revision: 501080
URL: http://svn.apache.org/viewvc?view=rev&rev=501080
Log:
complextype restriction with substition group fix
Modified:
xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
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?view=diff&rev=501080&r1=501079&r2=501080
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Mon Jan 29 07:25:46 2007
@@ -961,7 +961,7 @@
XMLCh nextCh;
const XMLCh* srcPtr = value;
XMLReader* fCurReader = getReaderMgr()->getCurrentReader();
-
+
if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing) {
nextCh = *srcPtr;
if (!fCurReader->isWhitespace(nextCh))
@@ -1427,14 +1427,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);
@@ -1445,6 +1437,8 @@
if (!aGrammar) { //something is wrong
return;
}
+
+ const XMLCh* derivedName = derivedSpecNode->getElement()->getLocalPart();
SchemaElementDecl* derivedElemDecl = findElement(derivedScope, derivedURI, derivedName, aGrammar);
@@ -1452,6 +1446,8 @@
return;
}
+ const XMLCh* baseName = baseSpecNode->getElement()->getLocalPart();
+ unsigned int baseURI = baseSpecNode->getElement()->getURI();
bool subsGroup = false;
if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI) {
@@ -1470,7 +1466,7 @@
}
subsGroup = true;
- }
+ }
if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(), derivedSpecNode->getMaxOccurs(),
baseSpecNode->getMinOccurs(), baseSpecNode->getMaxOccurs())) {
@@ -1644,16 +1640,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);
@@ -1715,7 +1712,6 @@
if (codeToThrow != XMLExcepts::NoError) {
ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager);
}
-
}
void
@@ -1738,7 +1734,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++) {
@@ -1778,9 +1774,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