From 9b44a54d4b545a71ee64da49d9491b6dae647db4 Mon Sep 17 00:00:00 2001 From: Khaled Noaman <knoaman@apache.org> Date: Thu, 20 Nov 2003 18:05:16 +0000 Subject: [PATCH] PSVI: Use a copy of the content spec node when creating the content model. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175412 13f79535-47bb-0310-9956-ffa450edef68 --- .../validators/schema/ComplexTypeInfo.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/xercesc/validators/schema/ComplexTypeInfo.cpp b/src/xercesc/validators/schema/ComplexTypeInfo.cpp index c99564dc5..92cd4a209 100644 --- a/src/xercesc/validators/schema/ComplexTypeInfo.cpp +++ b/src/xercesc/validators/schema/ComplexTypeInfo.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.20 2003/11/20 18:05:16 knoaman + * PSVI: Use a copy of the content spec node when creating the content model. + * * Revision 1.19 2003/11/13 23:20:47 peiyongz * initSize * @@ -490,6 +493,7 @@ XMLContentModel* ComplexTypeInfo::makeContentModel(const bool checkUPA, ContentS // expand the content spec first ContentSpecNode* aSpecNode = specNode; + XMLContentModel* retModel = 0; if (aSpecNode) { fContentSpecOrgURI = (unsigned int*) fMemoryManager->allocate @@ -497,21 +501,18 @@ XMLContentModel* ComplexTypeInfo::makeContentModel(const bool checkUPA, ContentS fContentSpecOrgURISize * sizeof(unsigned int) ); //new unsigned int[fContentSpecOrgURISize]; aSpecNode = convertContentSpecTree(aSpecNode, checkUPA); + retModel = buildContentModel(aSpecNode); fSpecNodesToDelete->addElement(aSpecNode); } else { - aSpecNode = convertContentSpecTree(fContentSpec, checkUPA); - if (aSpecNode != fContentSpec) { - if (!fAdoptContentSpec && (aSpecNode == fContentSpec->getFirst())) - fAdoptContentSpec = false; - else - fAdoptContentSpec = true; - - fContentSpec = aSpecNode; - } + // building content model for the complex type + aSpecNode = new (fMemoryManager) ContentSpecNode(*fContentSpec); + aSpecNode = convertContentSpecTree(aSpecNode, checkUPA); + retModel = buildContentModel(aSpecNode); + delete aSpecNode; } - return buildContentModel(aSpecNode); + return retModel; } XMLContentModel* ComplexTypeInfo::buildContentModel(ContentSpecNode* const aSpecNode) @@ -608,7 +609,7 @@ XMLContentModel* ComplexTypeInfo::createChildModel(ContentSpecNode* specNode, co ); } else if (((specType & 0x0f) == ContentSpecNode::Choice) - || (specType == ContentSpecNode::Sequence)) + || ((specType & 0x0f) == ContentSpecNode::Sequence)) { // // Lets see if both of the children are leafs. If so, then it has to @@ -698,7 +699,7 @@ ComplexTypeInfo::convertContentSpecTree(ContentSpecNode* const curNode, } else if (((curType & 0x0f) == ContentSpecNode::Choice) || (curType == ContentSpecNode::All) - || (curType == ContentSpecNode::Sequence)) + || ((curType & 0x0f) == ContentSpecNode::Sequence)) { ContentSpecNode* childNode = curNode->getFirst(); ContentSpecNode* leftNode = convertContentSpecTree(childNode, checkUPA); -- GitLab