You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/08/07 15:47:47 UTC

cvs commit: xml-xerces/c/src/internal ElemStack.cpp ElemStack.hpp XMLScanner.cpp

tng         01/08/07 06:47:47

  Modified:    c/src/internal ElemStack.cpp ElemStack.hpp XMLScanner.cpp
  Log:
  Schema: Fix unmatched end tag for qualified/unqualifed start tag.
  
  Revision  Changes    Path
  1.15      +11 -6     xml-xerces/c/src/internal/ElemStack.cpp
  
  Index: ElemStack.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/ElemStack.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ElemStack.cpp	2001/06/18 21:33:57	1.14
  +++ ElemStack.cpp	2001/08/07 13:47:47	1.15
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: ElemStack.cpp,v $
  + * Revision 1.15  2001/08/07 13:47:47  tng
  + * Schema: Fix unmatched end tag for qualified/unqualifed start tag.
  + *
    * Revision 1.14  2001/06/18 21:33:57  peiyongz
    * Memory leak fix: to addlevel(), by Erik Rydgren.
    *
  @@ -183,11 +186,11 @@
           fStack[fStackTop]->fMapCapacity = 0;
           fStack[fStackTop]->fMap = 0;
       }
  -    else 
  -    {     
  +    else
  +    {
           // Cleanup the old element before reuse
           unsigned int childCount = fStack[fStackTop]->fChildCount;
  -        for (unsigned int childIndex = 0; childIndex < childCount; ++childIndex)    
  +        for (unsigned int childIndex = 0; childIndex < childCount; ++childIndex)
               delete fStack[fStackTop]->fChildren[childIndex];
       }
   
  @@ -197,6 +200,7 @@
       fStack[fStackTop]->fChildCount = 0;
       fStack[fStackTop]->fMapCount = 0;
       fStack[fStackTop]->fValidationFlag = false;
  +    fStack[fStackTop]->fCurrentURI = fUnknownNamespaceId;
       fStack[fStackTop]->fCurrentScope = Grammar::TOP_LEVEL_SCOPE;
       fStack[fStackTop]->fCurrentGrammar = 0;
   
  @@ -223,11 +227,11 @@
           fStack[fStackTop]->fMapCapacity = 0;
           fStack[fStackTop]->fMap = 0;
       }
  -    else 
  -    {     
  +    else
  +    {
           // Cleanup the old element before reuse
           unsigned int childCount = fStack[fStackTop]->fChildCount;
  -        for (unsigned int childIndex = 0; childIndex < childCount; ++childIndex)    
  +        for (unsigned int childIndex = 0; childIndex < childCount; ++childIndex)
               delete fStack[fStackTop]->fChildren[childIndex];
       }
   
  @@ -237,6 +241,7 @@
       fStack[fStackTop]->fChildCount = 0;
       fStack[fStackTop]->fMapCount = 0;
       fStack[fStackTop]->fValidationFlag = false;
  +    fStack[fStackTop]->fCurrentURI = fUnknownNamespaceId;
       fStack[fStackTop]->fCurrentScope = Grammar::TOP_LEVEL_SCOPE;
       fStack[fStackTop]->fCurrentGrammar = 0;
   
  
  
  
  1.10      +18 -0     xml-xerces/c/src/internal/ElemStack.hpp
  
  Index: ElemStack.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/ElemStack.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ElemStack.hpp	2001/05/28 20:55:19	1.9
  +++ ElemStack.hpp	2001/08/07 13:47:47	1.10
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: ElemStack.hpp,v $
  + * Revision 1.10  2001/08/07 13:47:47  tng
  + * Schema: Fix unmatched end tag for qualified/unqualifed start tag.
  + *
    * Revision 1.9  2001/05/28 20:55:19  tng
    * Schema: Store Grammar in ElemStack as well.
    *
  @@ -180,6 +183,7 @@
           bool                fValidationFlag;
           int                 fCurrentScope;
           Grammar*            fCurrentGrammar;
  +        unsigned int        fCurrentURI;
       };
   
       enum MapModes
  @@ -222,6 +226,9 @@
       void setCurrentGrammar(Grammar* currentGrammar);
       Grammar* getCurrentGrammar();
   
  +    void setCurrentURI(unsigned int uri);
  +    unsigned int getCurrentURI();
  +
       // -----------------------------------------------------------------------
       //  Prefix map methods
       // -----------------------------------------------------------------------
  @@ -357,6 +364,17 @@
   inline void ElemStack::setCurrentGrammar(Grammar* currentGrammar)
   {
       fStack[fStackTop-1]->fCurrentGrammar = currentGrammar;
  +    return;
  +}
  +
  +inline unsigned int ElemStack::getCurrentURI()
  +{
  +    return fStack[fStackTop-1]->fCurrentURI;
  +}
  +
  +inline void ElemStack::setCurrentURI(unsigned int uri)
  +{
  +    fStack[fStackTop-1]->fCurrentURI = uri;
       return;
   }
   
  
  
  
  1.59      +5 -3      xml-xerces/c/src/internal/XMLScanner.cpp
  
  Index: XMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner.cpp,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- XMLScanner.cpp	2001/08/01 19:11:01	1.58
  +++ XMLScanner.cpp	2001/08/07 13:47:47	1.59
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner.cpp,v 1.58 2001/08/01 19:11:01 tng Exp $
  + * $Id: XMLScanner.cpp,v 1.59 2001/08/07 13:47:47 tng Exp $
    */
   
   
  @@ -1603,6 +1603,7 @@
       //  the element stack top contains the prefix to URI mappings for this
       //  element.
       //
  +    unsigned int topUri = fElemStack.getCurrentURI();
       const ElemStack::StackElem* topElem = fElemStack.popTop();
   
       // See if it was the root element, to avoid multiple calls below
  @@ -1611,8 +1612,7 @@
       // Make sure that its the end of the element that we expect
       XMLElementDecl* tempElement = topElem->fThisElement;
       if (fDoNamespaces && fGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
  -        if ((tempElement->getURI() != uriId) ||
  -            (XMLString::compareString(tempElement->getBaseName(), bbName.getRawBuffer())))
  +        if ((topUri != uriId) || (XMLString::compareString(tempElement->getBaseName(), bbName.getRawBuffer())))
           {
               emitError
               (
  @@ -3008,6 +3008,8 @@
       //  decl because we didn't know it yet.
       //
       fElemStack.setElement(elemDecl, fReaderMgr.getCurrentReaderNum());
  +    fElemStack.setCurrentURI(uriId);
  +
       if (fGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
           ComplexTypeInfo* typeinfo = ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo();
           if (typeinfo)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org