Author: amassari
Date: Sun Jul 13 13:01:22 2008
New Revision: 676426

URL: http://svn.apache.org/viewvc?rev=676426&view=rev
Log:
Backported fix for XERCESJ-773: build a representation of large 
minOccurs/maxOccurs in constant time and memory (which uses a counter during 
validation) for element and wildcard particles when each model group particle 
in the content model:

* has minOccurs/maxOccurs == 1; or
* contains only one element/wildcard particle with minOccurs/maxOccurs == 1

(XERCESC-1051)

Added:
    xerces/c/trunk/src/xercesc/validators/common/CMRepeatingLeaf.hpp   (with 
props)
Modified:
    xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
    xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj
    xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj
    xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj
    xerces/c/trunk/src/Makefile.am
    xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp
    xerces/c/trunk/src/xercesc/validators/common/CMLeaf.hpp
    xerces/c/trunk/src/xercesc/validators/common/ContentSpecNode.hpp
    xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp
    xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.hpp
    xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.cpp
    xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.hpp
    xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp

Modified: xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp 
(original)
+++ xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp Sun 
Jul 13 13:01:22 2008
@@ -2019,6 +2019,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\..\..\src\xercesc\validators\common\CMRepeatingLeaf.hpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\..\..\src\xercesc\validators\common\CMNode.hpp
 # End Source File
 # Begin Source File

Modified: 
xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj 
(original)
+++ xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj 
Sun Jul 13 13:01:22 2008
@@ -1904,6 +1904,9 @@
                                        
RelativePath="..\..\..\..\..\src\xercesc\validators\common\CMLeaf.hpp">
                                </File>
                                <File
+                                       
RelativePath="..\..\..\..\..\src\xercesc\validators\common\CMRepeatingLeaf.hpp">
+                               </File>
+                               <File
                                        
RelativePath="..\..\..\..\..\src\xercesc\validators\common\CMNode.hpp">
                                </File>
                                <File

Modified: 
xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj 
(original)
+++ xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj Sun 
Jul 13 13:01:22 2008
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
        ProjectType="Visual C++"
-       Version="8.00"
+       Version="8,00"
        Name="XercesLib"
        ProjectGUID="{152CE948-F659-4206-A50A-1D2B9658EF96}"
        RootNamespace="XercesLib"
@@ -2502,6 +2502,10 @@
                                        >
                                </File>
                                <File
+                                       
RelativePath="..\..\..\..\..\src\xercesc\util\regx\UniCharTable.hpp"
+                                       >
+                               </File>
+                               <File
                                        
RelativePath="..\..\..\..\..\src\xercesc\util\regx\UnicodeRangeFactory.cpp"
                                        >
                                </File>
@@ -3343,6 +3347,10 @@
                                        >
                                </File>
                                <File
+                                       
RelativePath="..\..\..\..\..\src\xercesc\validators\common\CMRepeatingLeaf.hpp"
+                                       >
+                               </File>
+                               <File
                                        
RelativePath="..\..\..\..\..\src\xercesc\validators\common\CMStateSet.hpp"
                                        >
                                </File>

Modified: 
xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj 
(original)
+++ xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj Sun 
Jul 13 13:01:22 2008
@@ -3454,6 +3454,10 @@
                                        >
                                </File>
                                <File
+                                       
RelativePath="..\..\..\..\..\src\xercesc\validators\common\CMRepeatingLeaf.hpp"
+                                       >
+                               </File>
+                               <File
                                        
RelativePath="..\..\..\..\..\src\xercesc\validators\common\CMNode.hpp"
                                        >
                                </File>

Modified: xerces/c/trunk/src/Makefile.am
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/Makefile.am?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/Makefile.am (original)
+++ xerces/c/trunk/src/Makefile.am Sun Jul 13 13:01:22 2008
@@ -799,6 +799,7 @@
        xercesc/validators/common/CMAny.hpp \
        xercesc/validators/common/CMBinaryOp.hpp \
        xercesc/validators/common/CMLeaf.hpp \
+       xercesc/validators/common/CMRepeatingLeaf.hpp \
        xercesc/validators/common/CMNode.hpp \
        xercesc/validators/common/CMStateSet.hpp \
        xercesc/validators/common/CMUnaryOp.hpp \

Modified: xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp Sun Jul 13 
13:01:22 2008
@@ -346,6 +346,31 @@
         toFill.addElement(leftNode->getElement());
         toOptional.addElement(true);
     }
+    // only allow ZeroOrMore when it's the father of a Loop
+    else if (curType == ContentSpecNode::ZeroOrMore &&
+             curNode->getFirst()!=0 &&
+             curNode->getFirst()->getType()==ContentSpecNode::Loop)
+    {
+        ContentSpecNode* leftNode = curNode->getFirst();
+        buildChildList(leftNode, toFill, toOptional);
+    }
+    else if (curType == ContentSpecNode::Loop)
+    {
+        // At leaf, add the element to list of elements permitted in the all
+        int i;
+        for(i=0;i<curNode->getMinOccurs();i++)
+        {
+            toFill.addElement(curNode->getElement());
+            toOptional.addElement(false);
+            fNumRequired++;
+        }
+        if(curNode->getMaxOccurs()!=-1)
+            for(i=0;i<(curNode->getMaxOccurs() - curNode->getMinOccurs());i++)
+            {
+                toFill.addElement(curNode->getElement());
+                toOptional.addElement(true);
+            }
+    }
     else
         ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, 
fMemoryManager);
 }

Modified: xerces/c/trunk/src/xercesc/validators/common/CMLeaf.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/CMLeaf.hpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/CMLeaf.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/CMLeaf.hpp Sun Jul 13 13:01:22 
2008
@@ -61,6 +61,7 @@
     const QName* getElement() const;
     unsigned int getPosition() const;
 
+    virtual bool isRepeatableLeaf() const;
 
     // -----------------------------------------------------------------------
     //  Setter methods
@@ -71,8 +72,7 @@
     // -----------------------------------------------------------------------
     //  Implementation of public CMNode virtual interface
     // -----------------------------------------------------------------------
-    bool isNullable() const;
-
+    virtual bool isNullable() const;
 
 protected :
     // -----------------------------------------------------------------------
@@ -190,6 +190,10 @@
     return fPosition;
 }
 
+inline bool CMLeaf::isRepeatableLeaf() const
+{
+    return false;
+}
 
 // ---------------------------------------------------------------------------
 //  Setter methods

Added: xerces/c/trunk/src/xercesc/validators/common/CMRepeatingLeaf.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/CMRepeatingLeaf.hpp?rev=676426&view=auto
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/CMRepeatingLeaf.hpp (added)
+++ xerces/c/trunk/src/xercesc/validators/common/CMRepeatingLeaf.hpp Sun Jul 13 
13:01:22 2008
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id$
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_CMREPEATINGLEAF_HPP)
+#define XERCESC_INCLUDE_GUARD_CMREPEATINGLEAF_HPP
+
+#include <xercesc/validators/common/CMLeaf.hpp>
+
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+//
+//  A compound content model leaf node which carries occurence information.
+//
+class CMRepeatingLeaf : public CMLeaf
+{
+public :
+    // -----------------------------------------------------------------------
+    //  Constructors
+    // -----------------------------------------------------------------------
+    CMRepeatingLeaf
+    (
+          QName* const         element
+        , int                  minOccurs
+        , int                  maxOccurs
+        , const unsigned int   position
+        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+    );
+    CMRepeatingLeaf
+    (
+          QName* const         element
+        , int                  minOccurs
+        , int                  maxOccurs
+        , const unsigned int   position
+        , const bool           adopt
+        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+    );
+
+
+    // -----------------------------------------------------------------------
+    //  Getter methods
+    // -----------------------------------------------------------------------
+    int getMinOccurs() const;
+    int getMaxOccurs() const;
+
+    virtual bool isRepeatableLeaf() const;
+
+private :
+    // -----------------------------------------------------------------------
+    //  Private data members
+    //
+    //  fMinOccurs
+    //  fMaxOccurs
+    //      The cardinality of the repeating leaf
+    //
+    // -----------------------------------------------------------------------
+    int             fMinOccurs;
+    int             fMaxOccurs;
+
+    // -----------------------------------------------------------------------
+    //  Unimplemented constructors and operators
+    // -----------------------------------------------------------------------
+    CMRepeatingLeaf(const CMRepeatingLeaf&);
+    CMRepeatingLeaf& operator=(const CMRepeatingLeaf&);
+};
+
+
+// -----------------------------------------------------------------------
+//  Constructors
+// -----------------------------------------------------------------------
+inline CMRepeatingLeaf::CMRepeatingLeaf(   QName* const               element
+                                         , int                        minOccurs
+                                         , int                        maxOccurs
+                                         , const unsigned int         position
+                                         ,       MemoryManager* const manager) 
:
+    CMLeaf(element, position, manager)
+    , fMinOccurs(minOccurs)
+    , fMaxOccurs(maxOccurs)
+{
+}
+
+inline CMRepeatingLeaf::CMRepeatingLeaf(   QName* const               element
+                                         , int                        minOccurs
+                                         , int                        maxOccurs
+                                         , const unsigned int         position
+                                         , const bool                 adopt
+                                         ,       MemoryManager* const manager) 
:
+    CMLeaf(element, position, adopt, manager)
+    , fMinOccurs(minOccurs)
+    , fMaxOccurs(maxOccurs)
+{
+}
+
+// ---------------------------------------------------------------------------
+//  Getter methods
+// ---------------------------------------------------------------------------
+inline int CMRepeatingLeaf::getMinOccurs() const
+{
+    return fMinOccurs;
+}
+
+inline int CMRepeatingLeaf::getMaxOccurs() const
+{
+    return fMaxOccurs;
+}
+
+inline bool CMRepeatingLeaf::isRepeatableLeaf() const
+{
+    return true;
+}
+
+XERCES_CPP_NAMESPACE_END
+
+#endif

Propchange: xerces/c/trunk/src/xercesc/validators/common/CMRepeatingLeaf.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/c/trunk/src/xercesc/validators/common/CMRepeatingLeaf.hpp
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: xerces/c/trunk/src/xercesc/validators/common/ContentSpecNode.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/ContentSpecNode.hpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/ContentSpecNode.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/ContentSpecNode.hpp Sun Jul 13 
13:01:22 2008
@@ -51,15 +51,16 @@
         , Any_Other
         , Any_NS = 8
         , All = 9
-        , Any_NS_Choice = 20
-        , ModelGroupSequence = 21
-        , Any_Lax = 22
-        , Any_Other_Lax = 23
-        , Any_NS_Lax = 24
-        , ModelGroupChoice = 36
-        , Any_Skip = 38
-        , Any_Other_Skip = 39
-        , Any_NS_Skip = 40
+        , Loop = 10
+        , Any_NS_Choice = 20            // 16 + 4 (Choice)
+        , ModelGroupSequence = 21       // 16 + 5 (Sequence)
+        , Any_Lax = 22                  // 16 + 6 (Any)
+        , Any_Other_Lax = 23            // 16 + 7 (Any_Other)
+        , Any_NS_Lax = 24               // 16 + 8 (Any_NS)
+        , ModelGroupChoice = 36         // 32 + 4 (Choice)
+        , Any_Skip = 38                 // 32 + 6 (Any)
+        , Any_Other_Skip = 39           // 32 + 7 (Any_Other)
+        , Any_NS_Skip = 40              // 32 + 8 (Any_NS)
 
         , UnknownType = -1
     };

Modified: xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp Sun Jul 13 
13:01:22 2008
@@ -30,6 +30,7 @@
 #include <xercesc/validators/common/CMAny.hpp>
 #include <xercesc/validators/common/CMBinaryOp.hpp>
 #include <xercesc/validators/common/CMLeaf.hpp>
+#include <xercesc/validators/common/CMRepeatingLeaf.hpp>
 #include <xercesc/validators/common/CMUnaryOp.hpp>
 #include <xercesc/validators/common/DFAContentModel.hpp>
 #include <xercesc/validators/common/ContentSpecNode.hpp>
@@ -64,6 +65,7 @@
     , fLeafListType(0)
     , fTransTable(0)
     , fTransTableSize(0)
+    , fCountingStates(0)
     , fDTD(dtd)
     , fIsMixed(false)
     , fLeafNameTypeVector(0)
@@ -91,6 +93,7 @@
     , fLeafListType(0)
     , fTransTable(0)
     , fTransTableSize(0)
+    , fCountingStates(0)
     , fDTD(dtd)
     , fIsMixed(isMixed)
     , fLeafNameTypeVector(0)
@@ -108,11 +111,18 @@
     //
     fMemoryManager->deallocate(fFinalStateFlags); //delete [] fFinalStateFlags;
 
-    unsigned index;
+    unsigned int index;
     for (index = 0; index < fTransTableSize; index++)
         fMemoryManager->deallocate(fTransTable[index]); //delete [] 
fTransTable[index];
     fMemoryManager->deallocate(fTransTable); //delete [] fTransTable;
 
+    if(fCountingStates)
+    {
+        for (unsigned int j = 0; j < fTransTableSize; ++j)
+            delete fCountingStates[j];
+        fMemoryManager->deallocate(fCountingStates);
+    }
+
     for (index = 0; index < fLeafCount; index++)
         delete fElemMap[index];
     fMemoryManager->deallocate(fElemMap); //delete [] fElemMap;
@@ -155,6 +165,7 @@
     //
     unsigned int curState = 0;
     unsigned int nextState = 0;
+    unsigned int loopCount = 0;
     unsigned int childIndex = 0;
     for (; childIndex < childCount; childIndex++)
     {
@@ -210,7 +221,7 @@
                 else if ((type & 0x0f) == ContentSpecNode::Any_Other)
                 {
                     // Here we assume that empty string has id 1.
-                //
+                    //
                     unsigned int uriId = curElem->getURI();
                     if (uriId != 1 && uriId != inElem->getURI()) {
                         nextState = fTransTable[curState][elemIndex];
@@ -235,6 +246,41 @@
             return false;
         }
 
+        if (fCountingStates != 0) {
+            Occurence* o = fCountingStates[curState];
+            if (o != 0) {
+                if (curState == nextState) {
+                    if (++loopCount > (unsigned int)o->maxOccurs && 
o->maxOccurs != -1) {
+                        *indexFailingChild=childIndex;
+                        return false;
+                    }  
+                }
+                else if (loopCount < (unsigned int)o->minOccurs) {
+                    // not enough loops on the current state.
+                    *indexFailingChild=childIndex;
+                    return false;
+                }
+                else {
+                    // Exiting a counting state. If we're entering a new
+                    // counting state, reset the counter.
+                    o = fCountingStates[nextState];
+                    if (o != 0) {
+                        loopCount = (elemIndex == o->elemIndex) ? 1 : 0;
+                    }
+                }
+            }
+            else {
+                o = fCountingStates[nextState];
+                if (o != 0) {
+                    // Entering a new counting state. Reset the counter.
+                    // If we've already seen one instance of the looping
+                    // particle set the counter to 1, otherwise set it 
+                    // to 0.
+                    loopCount = (elemIndex == o->elemIndex) ? 1 : 0;
+                }
+            }
+        }
+
         curState = nextState;
         nextState = 0;
 
@@ -251,6 +297,16 @@
         return false;
     }
 
+    // verify if we exited before the minOccurs was satisfied
+    if (fCountingStates != 0) {
+        Occurence* o = fCountingStates[curState];
+        if (o != 0 && loopCount < (unsigned int)o->minOccurs) {
+            // not enough loops on the current state to be considered final.
+            *indexFailingChild=childIndex;
+            return false;
+        }
+    }
+
     //success
     return true;
 }
@@ -280,6 +336,7 @@
     //  an element index to a state index.
     //
     unsigned int curState = 0;
+    unsigned int loopCount = 0;
     unsigned int nextState = 0;
     unsigned int childIndex = 0;
     for (; childIndex < childCount; childIndex++)
@@ -351,6 +408,41 @@
             return false;
         }
 
+        if (fCountingStates != 0) {
+            Occurence* o = fCountingStates[curState];
+            if (o != 0) {
+                if (curState == nextState) {
+                    if (++loopCount > (unsigned int)o->maxOccurs && 
o->maxOccurs != -1) {
+                        *indexFailingChild=childIndex;
+                        return false;
+                    }  
+                }
+                else if (loopCount < (unsigned int)o->minOccurs) {
+                    // not enough loops on the current state.
+                    *indexFailingChild=childIndex;
+                    return false;
+                }
+                else {
+                    // Exiting a counting state. If we're entering a new
+                    // counting state, reset the counter.
+                    o = fCountingStates[nextState];
+                    if (o != 0) {
+                        loopCount = (elemIndex == o->elemIndex) ? 1 : 0;
+                    }
+                }
+            }
+            else {
+                o = fCountingStates[nextState];
+                if (o != 0) {
+                    // Entering a new counting state. Reset the counter.
+                    // If we've already seen one instance of the looping
+                    // particle set the counter to 1, otherwise set it 
+                    // to 0.
+                    loopCount = (elemIndex == o->elemIndex) ? 1 : 0;
+                }
+            }
+        }
+
         curState = nextState;
         nextState = 0;
 
@@ -367,6 +459,18 @@
         return false;
     }
 
+    // verify if we exited before the minOccurs was satisfied
+    if (fCountingStates != 0) {
+        Occurence* o = fCountingStates[curState];
+        if (o != 0) {
+            if (loopCount < (unsigned int)o->minOccurs) {
+                // not enough loops on the current state.
+                *indexFailingChild=childIndex;
+                return false;
+            }
+        }
+    }
+
     //success
     return true;
 }
@@ -499,7 +603,7 @@
     ); //new ContentSpecNode::NodeTypes[fLeafCount];
     fElemMapSize = 0;
 
-
+    Occurence** elemOccurenceMap=0;
     for (unsigned int outIndex = 0; outIndex < fLeafCount; outIndex++)
     {
         fElemMap[outIndex] = new (fMemoryManager) QName(fMemoryManager);
@@ -509,7 +613,8 @@
                 fLeafNameTypeVector = new (fMemoryManager) 
ContentLeafNameTypeVector(fMemoryManager);
 
         // Get the current leaf's element index
-        const QName* element = fLeafList[outIndex]->getElement();
+        CMLeaf* leaf=fLeafList[outIndex];
+        const QName* element = leaf->getElement();
         const XMLCh* elementRawName = 0;
         if (fDTD && element)
             elementRawName = element->getRawName();
@@ -538,6 +643,14 @@
         if (inIndex == fElemMapSize)
         {
             fElemMap[fElemMapSize]->setValues(*element);
+            if(leaf->isRepeatableLeaf())
+            {
+                if (elemOccurenceMap == 0) {
+                    elemOccurenceMap = 
(Occurence**)fMemoryManager->allocate(fLeafCount*sizeof(Occurence*));
+                    memset(elemOccurenceMap, 0, fLeafCount*sizeof(Occurence*));
+                }
+                elemOccurenceMap[fElemMapSize] = new (fMemoryManager) 
Occurence(((CMRepeatingLeaf*)leaf)->getMinOccurs(), 
((CMRepeatingLeaf*)leaf)->getMaxOccurs(), fElemMapSize);
+            }
             fElemMapType[fElemMapSize] = fLeafListType[outIndex];
             ++fElemMapSize;
         }
@@ -850,6 +963,31 @@
     // Store the current state count in the trans table size
     fTransTableSize = curState;
 
+    //
+    // Fill in the occurence information for each looping state 
+    // if we're using counters.
+    //
+    if (elemOccurenceMap != 0) {
+        fCountingStates = 
(Occurence**)fMemoryManager->allocate(fTransTableSize*sizeof(Occurence));
+        memset(fCountingStates, 0, fTransTableSize*sizeof(Occurence*));
+        for (unsigned int i = 0; i < fTransTableSize; ++i) {
+            unsigned int * transitions = fTransTable[i];
+            for (unsigned int j = 0; j < fElemMapSize; ++j) {
+                if (i == transitions[j]) {
+                    Occurence* old=elemOccurenceMap[j];
+                    if(old!=0)
+                        fCountingStates[i] = new (fMemoryManager) 
Occurence(old->minOccurs, old->maxOccurs, old->elemIndex);
+                    break;
+                }
+            }
+        }
+        for (unsigned int j = 0; j < fLeafCount; ++j) {
+            if(elemOccurenceMap[j]!=0)
+                delete elemOccurenceMap[j];
+        }
+        fMemoryManager->deallocate(elemOccurenceMap);
+    }
+
     // If the last temp set was not stored, then clean it up
     if (newSet)
         delete newSet;
@@ -931,6 +1069,23 @@
             , fMemoryManager
         );
     }
+    else if (curType == ContentSpecNode::Loop)
+    {
+        //
+        //  Create a new leaf node, and pass it the current leaf count, which
+        //  is its DFA state position. Bump the leaf count after storing it.
+        //  This makes the positions zero based since we store first and then
+        //  increment.
+        //
+        retNode = new (fMemoryManager) CMRepeatingLeaf
+        (
+            curNode->getFirst()->getElement()
+            , curNode->getMinOccurs()
+            , curNode->getMaxOccurs()
+            , fLeafCount++
+            , fMemoryManager
+        );
+    }
      else
     {
         //
@@ -1110,11 +1265,12 @@
     }
     else if (curType == ContentSpecNode::Leaf)
     {
+        CMLeaf* leaf=(CMLeaf*)nodeCur;
         //
         //  Put this node in the leaf list at the current index if its
         //  a non-epsilon leaf.
         //
-        if (((CMLeaf*)nodeCur)->getElement()->getURI() != 
XMLContentModel::gEpsilonFakeId)
+        if (leaf->getElement()->getURI() != XMLContentModel::gEpsilonFakeId)
         {
             //
             // fLeafList make its own copy of the CMLeaf, so that
@@ -1122,12 +1278,22 @@
             // will NOT delete the nodeCur --twice--,
             // thuse to make delete the owner of the nodeCur possible.
             //
-            fLeafList[newIndex] = new (fMemoryManager) CMLeaf
-            (
-                ((CMLeaf*)nodeCur)->getElement()
-                , ((CMLeaf*)nodeCur)->getPosition()
-                , fMemoryManager
-            );
+            if(leaf->isRepeatableLeaf())
+                fLeafList[newIndex] = new (fMemoryManager) CMRepeatingLeaf
+                (
+                    leaf->getElement()
+                    , ((CMRepeatingLeaf*)leaf)->getMinOccurs()
+                    , ((CMRepeatingLeaf*)leaf)->getMaxOccurs()
+                    , leaf->getPosition()
+                    , fMemoryManager
+                );
+            else
+                fLeafList[newIndex] = new (fMemoryManager) CMLeaf
+                (
+                    leaf->getElement()
+                    , leaf->getPosition()
+                    , fMemoryManager
+                );
             fLeafListType[newIndex] = ContentSpecNode::Leaf;
             ++newIndex;
         }
@@ -1209,6 +1375,18 @@
                                                         fElemMapType[k],
                                                         fElemMap[k],
                                                         &comparator)) {
+                        if (fCountingStates != 0) {
+                            Occurence* o = fCountingStates[i];
+                            // If "i" is a counting state and exactly one of 
the transitions
+                            // loops back to "i" then the two particles do not 
overlap if
+                            // minOccurs == maxOccurs.
+                            if (o != 0 && 
+                                ((fTransTable[i][j] == i) ^ (fTransTable[i][k] 
== i)) && 
+                                o->minOccurs == o->maxOccurs) {
+                                conflictTable[j][k] = -1;
+                                continue;
+                            }
+                        }
                        conflictTable[j][k] = 1;
 
                        XMLBuffer buf1(1023, fMemoryManager);

Modified: xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.hpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.hpp Sun Jul 13 
13:01:22 2008
@@ -31,6 +31,7 @@
 
 class ContentSpecNode;
 class CMLeaf;
+class CMRepeatingLeaf;
 class CMNode;
 class CMStateSet;
 
@@ -130,6 +131,16 @@
     );
 
 
+    class Occurence : public XMemory
+    {
+    public:
+        Occurence(int minOcc, int maxOcc, int eltIndex);
+
+        int minOccurs;
+        int maxOccurs;
+        int elemIndex;
+    };
+
     // -----------------------------------------------------------------------
     //  Private data members
     //
@@ -201,6 +212,10 @@
     //      fTransTableSize is the number of valid entries in the transition
     //      table, and in the other related tables such as fFinalStateFlags.
     //
+    //  fCountingStates
+    //      This is the table holding the minOccurs/maxOccurs for elements
+    //      that can be repeated a finite number of times.
+    //
     //  fDTD
     //      Boolean to allow DTDs to validate even with namespace support.
     //
@@ -220,6 +235,7 @@
     ContentSpecNode::NodeTypes* fLeafListType;
     unsigned int**              fTransTable;
     unsigned int                fTransTableSize;
+    Occurence**                 fCountingStates;
     bool                        fDTD;
     bool                        fIsMixed;
     ContentLeafNameTypeVector * fLeafNameTypeVector;
@@ -242,6 +258,14 @@
     return fTransTable[currentState][elementIndex];
 }
 
+inline
+DFAContentModel::Occurence::Occurence(int minOcc, int maxOcc, int eltIndex)
+{
+    minOccurs = minOcc;
+    maxOccurs = maxOcc;
+    elemIndex = eltIndex;
+}
+
 XERCES_CPP_NAMESPACE_END
 
 #endif

Modified: xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.cpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.cpp Sun Jul 13 
13:01:22 2008
@@ -288,10 +288,39 @@
     return newValue;
 }
 
-XMLContentModel* ComplexTypeInfo::makeContentModel(const bool checkUPA)
+bool ComplexTypeInfo::useRepeatingLeafNodes(ContentSpecNode* particle) 
+{
+    int maxOccurs = particle->getMaxOccurs();
+    int minOccurs = particle->getMinOccurs();
+    ContentSpecNode::NodeTypes type = particle->getType();
+    
+    if (((type & 0x0f) == ContentSpecNode::Choice) ||  ((type & 0x0f) == 
ContentSpecNode::Sequence))
+    {
+        if (minOccurs != 1 || maxOccurs != 1) {
+            if(particle->getFirst()!=0 && particle->getSecond()==0)
+            {
+                ContentSpecNode* particle2 = particle->getFirst();
+                ContentSpecNode::NodeTypes type2 = particle2->getType();
+                return (((type2 == ContentSpecNode::Leaf) ||
+                        ((type2 & 0x0f) == ContentSpecNode::Any) || 
+                        ((type2 & 0x0f) == ContentSpecNode::Any_Other) ||
+                        ((type2 & 0x0f) == ContentSpecNode::Any_NS)) &&
+                        particle2->getMinOccurs() == 1 &&
+                        particle2->getMaxOccurs() == 1);
+            }
+            return (particle->getFirst()==0 && particle->getSecond()==0);
+        }
+        if(particle->getFirst()!=0 && 
!useRepeatingLeafNodes(particle->getFirst()))
+            return false;
+        if(particle->getSecond()!=0 && 
!useRepeatingLeafNodes(particle->getSecond()))
+            return false;
+    }
+    return true;
+}
+
+XMLContentModel* ComplexTypeInfo::makeContentModel(bool checkUPA)
 {
     ContentSpecNode* aSpecNode = new (fMemoryManager) 
ContentSpecNode(*fContentSpec);
-    XMLContentModel* retModel = 0;
 
     if (checkUPA) {
         fContentSpecOrgURI = (unsigned int*) fMemoryManager->allocate
@@ -300,15 +329,10 @@
         ); //new unsigned int[fContentSpecOrgURISize];
     }
 
-    aSpecNode = convertContentSpecTree(aSpecNode, checkUPA);
-    retModel = buildContentModel(aSpecNode);
+    aSpecNode = convertContentSpecTree(aSpecNode, checkUPA, 
useRepeatingLeafNodes(aSpecNode));
 
-    delete aSpecNode;
-    return retModel;
-}
+    Janitor<ContentSpecNode> janSpecNode(aSpecNode);
 
-XMLContentModel* ComplexTypeInfo::buildContentModel(ContentSpecNode* const 
aSpecNode)
-{
     XMLContentModel* cmRet = 0;
     if (fContentType == SchemaElementDecl::Simple ||
         fContentType == SchemaElementDecl::ElementOnlyEmpty) {
@@ -322,12 +346,11 @@
         //
         cmRet = new (fMemoryManager) MixedContentModel(false, aSpecNode, 
false, fMemoryManager);
     }
-    else if (fContentType == SchemaElementDecl::Mixed_Complex) {
-
-            cmRet = createChildModel(aSpecNode, true);
-    }
-    else if (fContentType == SchemaElementDecl::Children)
+    else if (fContentType == SchemaElementDecl::Mixed_Complex ||
+             fContentType == SchemaElementDecl::Children) 
     {
+        bool isMixed = (fContentType == SchemaElementDecl::Mixed_Complex);
+
         //
         //  This method will create an optimal model for the complexity
         //  of the element's defined model. If its simple, it will create
@@ -335,132 +358,128 @@
         //  create a SimpleListContentModel object. If its complex, it
         //  will create a DFAContentModel object.
         //
-         cmRet = createChildModel(aSpecNode, false);
-    }
-     else
-    {
-        ThrowXMLwithMemMgr(RuntimeException, 
XMLExcepts::CM_MustBeMixedOrChildren, fMemoryManager);
-    }
+        if(!aSpecNode)
+            ThrowXMLwithMemMgr(RuntimeException, 
XMLExcepts::CM_UnknownCMSpecType, fMemoryManager);
 
-    return cmRet;
-}
-
-// ---------------------------------------------------------------------------
-//  SchemaElementDecl: Private helper methods
-// ---------------------------------------------------------------------------
-XMLContentModel* ComplexTypeInfo::createChildModel(ContentSpecNode* specNode, 
const bool isMixed)
-{
-    if(!specNode)
-        ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, 
fMemoryManager);
-
-    ContentSpecNode::NodeTypes specType = specNode->getType();
-    //
-    //  Do a sanity check that the node is does not have a PCDATA id. Since,
-    //  if it was, it should have already gotten taken by the Mixed model.
-    //
-    if (specNode->getElement()) {
-        if (specNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId)
+        ContentSpecNode::NodeTypes specType = aSpecNode->getType();
+        //
+        //  Do a sanity check that the node is does not have a PCDATA id. 
Since,
+        //  if it was, it should have already gotten taken by the Mixed model.
+        //
+        if (aSpecNode->getElement() && aSpecNode->getElement()->getURI() == 
XMLElementDecl::fgPCDataElemId)
             ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_NoPCDATAHere, 
fMemoryManager);
-    }
 
-    //
-    //  According to the type of node, we will create the correct type of
-    //  content model.
-    //
-    if (((specType & 0x0f) == ContentSpecNode::Any) ||
-       ((specType & 0x0f) == ContentSpecNode::Any_Other) ||
-       ((specType & 0x0f) == ContentSpecNode::Any_NS)) {
-       // let fall through to build a DFAContentModel
-    }
-    else if (isMixed)
-    {
-        if (specType == ContentSpecNode::All) {
-            // All the nodes under an ALL must be additional ALL nodes and
-            // ELEMENTs (or ELEMENTs under ZERO_OR_ONE nodes.)
-            // We collapse the ELEMENTs into a single vector.
-            return new (fMemoryManager) AllContentModel(specNode, true, 
fMemoryManager);
-        }
-        else if (specType == ContentSpecNode::ZeroOrOne) {
-            // An ALL node can appear under a ZERO_OR_ONE node.
-            if (specNode->getFirst()->getType() == ContentSpecNode::All) {
-                return new (fMemoryManager) 
AllContentModel(specNode->getFirst(), true, fMemoryManager);
-            }
-        }
-
-        // otherwise, let fall through to build a DFAContentModel
-    }
-     else if (specType == ContentSpecNode::Leaf)
-    {
-        // Create a simple content model
-        return new (fMemoryManager) SimpleContentModel
-        (
-            false
-            , specNode->getElement()
-            , 0
-            , ContentSpecNode::Leaf
-            , fMemoryManager
-        );
-    }
-     else if (((specType & 0x0f) == ContentSpecNode::Choice)
-          ||  ((specType & 0x0f) == ContentSpecNode::Sequence))
-    {
         //
-        //  Lets see if both of the children are leafs. If so, then it has to
-        //  be a simple content model
+        //  According to the type of node, we will create the correct type of
+        //  content model.
         //
-        if ((specNode->getFirst()->getType() == ContentSpecNode::Leaf)
-        &&  (specNode->getSecond())
-        &&  (specNode->getSecond()->getType() == ContentSpecNode::Leaf))
+        if (((specType & 0x0f) == ContentSpecNode::Any) ||
+           ((specType & 0x0f) == ContentSpecNode::Any_Other) ||
+           ((specType & 0x0f) == ContentSpecNode::Any_NS) ||
+           specType == ContentSpecNode::Loop) {
+           // let fall through to build a DFAContentModel
+        }
+        else if (isMixed)
         {
-            return new (fMemoryManager) SimpleContentModel
-            (
-                false
-                , specNode->getFirst()->getElement()
-                , specNode->getSecond()->getElement()
-                , specType
-                , fMemoryManager
-            );
+            if (specType == ContentSpecNode::All) {
+                // All the nodes under an ALL must be additional ALL nodes and
+                // ELEMENTs (or ELEMENTs under ZERO_OR_ONE nodes.)
+                // We collapse the ELEMENTs into a single vector.
+                cmRet = new (fMemoryManager) AllContentModel(aSpecNode, true, 
fMemoryManager);
+            }
+            else if (specType == ContentSpecNode::ZeroOrOne) {
+                // An ALL node can appear under a ZERO_OR_ONE node.
+                if (aSpecNode->getFirst()->getType() == ContentSpecNode::All) {
+                    cmRet = new (fMemoryManager) 
AllContentModel(aSpecNode->getFirst(), true, fMemoryManager);
+                }
+            }
+
+            // otherwise, let fall through to build a DFAContentModel
         }
-    }
-     else if ((specType == ContentSpecNode::OneOrMore)
-          ||  (specType == ContentSpecNode::ZeroOrMore)
-          ||  (specType == ContentSpecNode::ZeroOrOne))
-    {
-        //
-        //  Its a repetition, so see if its one child is a leaf. If so its a
-        //  repetition of a single element, so we can do a simple content
-        //  model for that.
-        //
-        if (specNode->getFirst()->getType() == ContentSpecNode::Leaf)
+         else if (specType == ContentSpecNode::Leaf)
         {
-            return new (fMemoryManager) SimpleContentModel
+            // Create a simple content model
+            cmRet = new (fMemoryManager) SimpleContentModel
             (
                 false
-                , specNode->getFirst()->getElement()
+                , aSpecNode->getElement()
                 , 0
-                , specType
+                , ContentSpecNode::Leaf
                 , fMemoryManager
             );
         }
-        else if (specNode->getFirst()->getType() == ContentSpecNode::All)
-            return new (fMemoryManager) AllContentModel(specNode->getFirst(), 
false, fMemoryManager);
+         else if (((specType & 0x0f) == ContentSpecNode::Choice)
+              ||  ((specType & 0x0f) == ContentSpecNode::Sequence))
+        {
+            //
+            //  Lets see if both of the children are leafs. If so, then it has 
to
+            //  be a simple content model
+            //
+            if ((aSpecNode->getFirst()->getType() == ContentSpecNode::Leaf)
+            &&  (aSpecNode->getSecond())
+            &&  (aSpecNode->getSecond()->getType() == ContentSpecNode::Leaf))
+            {
+                cmRet = new (fMemoryManager) SimpleContentModel
+                (
+                    false
+                    , aSpecNode->getFirst()->getElement()
+                    , aSpecNode->getSecond()->getElement()
+                    , specType
+                    , fMemoryManager
+                );
+            }
+        }
+         else if ((specType == ContentSpecNode::OneOrMore)
+              ||  (specType == ContentSpecNode::ZeroOrMore)
+              ||  (specType == ContentSpecNode::ZeroOrOne))
+        {
+            //
+            //  Its a repetition, so see if its one child is a leaf. If so its 
a
+            //  repetition of a single element, so we can do a simple content
+            //  model for that.
+            //
+            if (aSpecNode->getFirst()->getType() == ContentSpecNode::Leaf)
+            {
+                cmRet = new (fMemoryManager) SimpleContentModel
+                (
+                    false
+                    , aSpecNode->getFirst()->getElement()
+                    , 0
+                    , specType
+                    , fMemoryManager
+                );
+            }
+            else if (aSpecNode->getFirst()->getType() == ContentSpecNode::All)
+                cmRet = new (fMemoryManager) 
AllContentModel(aSpecNode->getFirst(), false, fMemoryManager);
 
-    }
-    else if (specType == ContentSpecNode::All)
-        return new (fMemoryManager) AllContentModel(specNode, false, 
fMemoryManager);
+        }
+        else if (specType == ContentSpecNode::All)
+            cmRet = new (fMemoryManager) AllContentModel(aSpecNode, false, 
fMemoryManager);
+        else
+        {
+            ThrowXMLwithMemMgr(RuntimeException, 
XMLExcepts::CM_UnknownCMSpecType, fMemoryManager);
+        }
 
-    else
+        // Its not any simple type of content, so create a DFA based content 
model
+        if(cmRet==0)
+            cmRet = new (fMemoryManager) DFAContentModel(false, aSpecNode, 
isMixed, fMemoryManager);
+    }
+     else
     {
-        ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_UnknownCMSpecType, 
fMemoryManager);
+        ThrowXMLwithMemMgr(RuntimeException, 
XMLExcepts::CM_MustBeMixedOrChildren, fMemoryManager);
     }
 
-    // Its not any simple type of content, so create a DFA based content model
-    return new (fMemoryManager) DFAContentModel(false, specNode, isMixed, 
fMemoryManager);
+    return cmRet;
 }
 
+// ---------------------------------------------------------------------------
+//  SchemaElementDecl: Private helper methods
+// ---------------------------------------------------------------------------
+
 ContentSpecNode*
 ComplexTypeInfo::convertContentSpecTree(ContentSpecNode* const curNode,
-                                        const bool checkUPA) {
+                                        bool checkUPA,
+                                        bool bAllowCompactSyntax) {
 
     if (!curNode)
         return 0;
@@ -490,19 +509,19 @@
         || (curType & 0x0f) == ContentSpecNode::Any_NS
         || curType == ContentSpecNode::Leaf)
     {
-        retNode =  expandContentModel(curNode, minOccurs, maxOccurs);
+        retNode =  expandContentModel(curNode, minOccurs, maxOccurs, 
bAllowCompactSyntax);
     }
     else if (((curType & 0x0f) == ContentSpecNode::Choice)
         ||   (curType == ContentSpecNode::All)
         ||   ((curType & 0x0f) == ContentSpecNode::Sequence))
     {
         ContentSpecNode* childNode = curNode->getFirst();
-        ContentSpecNode* leftNode = convertContentSpecTree(childNode, 
checkUPA);
+        ContentSpecNode* leftNode = convertContentSpecTree(childNode, 
checkUPA, bAllowCompactSyntax);
         ContentSpecNode* rightNode = curNode->getSecond();
 
         if (!rightNode) {
 
-            retNode = expandContentModel(leftNode, minOccurs, maxOccurs);
+            retNode = expandContentModel(leftNode, minOccurs, maxOccurs, 
bAllowCompactSyntax);
             curNode->setAdoptFirst(false);
             delete curNode;
             return retNode;
@@ -516,7 +535,7 @@
         }
 
         childNode = rightNode;
-        rightNode =  convertContentSpecTree(childNode, checkUPA);
+        rightNode =  convertContentSpecTree(childNode, checkUPA, 
bAllowCompactSyntax);
 
         if (rightNode != childNode) {
 
@@ -525,15 +544,16 @@
             curNode->setAdoptSecond(true);
         }
 
-        retNode =  expandContentModel(curNode, minOccurs, maxOccurs);
+        retNode =  expandContentModel(curNode, minOccurs, maxOccurs, 
bAllowCompactSyntax);
     }
 
     return retNode;
 }
 
 ContentSpecNode* ComplexTypeInfo::expandContentModel(ContentSpecNode* const 
specNode,
-                                                     const int minOccurs,
-                                                     const int maxOccurs)
+                                                     int minOccurs,
+                                                     int maxOccurs,
+                                                     bool bAllowCompactSyntax)
 {
     if (!specNode) {
         return 0;
@@ -578,6 +598,43 @@
             , fMemoryManager
         );
     }
+    // if what is being repeated is a leaf avoid expanding the tree
+    else if(bAllowCompactSyntax && saveNode->getType()==ContentSpecNode::Leaf)
+    {
+        retNode = new (fMemoryManager) ContentSpecNode
+        (
+            ContentSpecNode::Loop
+            , retNode
+            , 0
+            , false
+            , true
+            , fMemoryManager
+        );
+        retNode->setMinOccurs(minOccurs);
+        retNode->setMaxOccurs(maxOccurs);
+        
+        if(minOccurs==0)
+            retNode = new (fMemoryManager) ContentSpecNode
+            (
+                ContentSpecNode::ZeroOrMore
+                , retNode
+                , 0
+                , true
+                , true
+                , fMemoryManager
+            );
+        else
+            retNode = new (fMemoryManager) ContentSpecNode
+            (
+                ContentSpecNode::OneOrMore
+                , retNode
+                , 0
+                , true
+                , true
+                , fMemoryManager
+            );
+
+    }
     else if (maxOccurs == -1) {
 
         retNode = new (fMemoryManager) ContentSpecNode
@@ -590,7 +647,7 @@
             , fMemoryManager
         );
 
-        for (int i=0; i < (int)(minOccurs-1); i++) {
+        for (int i=0; i < (minOccurs-1); i++) {
             retNode = new (fMemoryManager) ContentSpecNode
             (
                 ContentSpecNode::Sequence
@@ -618,7 +675,7 @@
 
             retNode = optional;
 
-            for (int i=0; i < (int)(maxOccurs-minOccurs-1); i++) {
+            for (int i=0; i < (maxOccurs-1); i++) {
                 retNode = new (fMemoryManager) ContentSpecNode
                 (
                     ContentSpecNode::Sequence
@@ -644,7 +701,7 @@
                     , fMemoryManager
                 );
 
-                for (int i=1; i < (int)(minOccurs-1); i++) {
+                for (int i=1; i < (minOccurs-1); i++) {
                     retNode = new (fMemoryManager) ContentSpecNode
                     (
                         ContentSpecNode::Sequence
@@ -686,7 +743,7 @@
                     retNode = new (fMemoryManager) ContentSpecNode
                     (
                         ContentSpecNode::Sequence
-                                           , retNode
+                        , retNode
                         , optional
                         , true
                         , false

Modified: xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.hpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/ComplexTypeInfo.hpp Sun Jul 13 
13:01:22 2008
@@ -170,12 +170,11 @@
     //  Private helper methods
     // -----------------------------------------------------------------------
     void faultInAttDefList() const;
-    XMLContentModel* createChildModel(ContentSpecNode* specNode, const bool 
isMixed);
-    XMLContentModel* makeContentModel(const bool checkUPA = false);
-    XMLContentModel* buildContentModel(ContentSpecNode* const specNode);
+    bool useRepeatingLeafNodes(ContentSpecNode* particle);
+    XMLContentModel* makeContentModel(bool checkUPA = false);
     XMLCh* formatContentModel () const ;
-    ContentSpecNode* expandContentModel(ContentSpecNode* const curNode, const 
int minOccurs, const int maxOccurs);
-    ContentSpecNode* convertContentSpecTree(ContentSpecNode* const curNode, 
const bool checkUPA = false);
+    ContentSpecNode* expandContentModel(ContentSpecNode* const curNode, int 
minOccurs, int maxOccurs, bool bAllowCompactSyntax);
+    ContentSpecNode* convertContentSpecTree(ContentSpecNode* const curNode, 
bool checkUPA, bool bAllowCompactSyntax);
     void resizeContentSpecOrgURI();
 
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp?rev=676426&r1=676425&r2=676426&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/XSTSHarnessHandlers.cpp Sun Jul 13 
13:01:22 2008
@@ -134,22 +134,12 @@
             fCurrentTest.fXSDName.setURL(dummy);
             StrX x(attrs.getValue(szNAME));
             const char* groupName=x.localForm();
-            if(XMLString::equals(groupName,"elemJ003") ||
-               XMLString::equals(groupName,"elemJ011") ||
-               XMLString::equals(groupName,"mgEa005") ||
-               XMLString::equals(groupName,"mgG014") ||
-               XMLString::equals(groupName,"mgHa005") ||
-               XMLString::equals(groupName,"mgJ014") ||
+            if(XMLString::equals(groupName,"addB194") ||
+               XMLString::equals(groupName,"isDefault072") ||     // this 
fails because of an access violation
                XMLString::equals(groupName,"particlesA012") ||
                XMLString::equals(groupName,"particlesA013") ||
                XMLString::equals(groupName,"particlesA014") ||
                XMLString::equals(groupName,"particlesA015") ||
-               XMLString::equals(groupName,"particlesIe003") ||
-               XMLString::equals(groupName,"particlesJb003") ||
-               XMLString::equals(groupName,"particlesJd003") ||
-               XMLString::equals(groupName,"particlesJf003") ||
-               XMLString::equals(groupName,"particlesJk003") ||
-               XMLString::equals(groupName,"particlesR005") ||
                XMLString::equals(groupName,"particlesZ033_c") ||
                XMLString::equals(groupName,"particlesZ033_d") ||
                XMLString::equals(groupName,"particlesZ033_e") ||
@@ -159,8 +149,6 @@
                XMLString::equals(groupName,"particlesZ036_b1") ||
                XMLString::equals(groupName,"particlesZ036_b2") ||
                XMLString::equals(groupName,"particlesZ036_c") ||
-               XMLString::equals(groupName,"addB194") ||
-               XMLString::equals(groupName,"isDefault072") ||     // this 
fails because of an access violation
                XMLString::equals(groupName,"wildB011") ||
                XMLString::equals(groupName,"wildB019") ||
                XMLString::equals(groupName,"wildG032") )



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to