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/09/07 19:35:16 UTC

cvs commit: xml-xerces/c/src/internal XMLScanner2.cpp

tng         01/09/07 10:35:16

  Modified:    c/src/internal XMLScanner2.cpp
  Log:
  Even we received all spaces, if the element is AllCharData, the parser should still normalize it for schema.
  
  Revision  Changes    Path
  1.56      +21 -3     xml-xerces/c/src/internal/XMLScanner2.cpp
  
  Index: XMLScanner2.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner2.cpp,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- XMLScanner2.cpp	2001/08/29 17:37:00	1.55
  +++ XMLScanner2.cpp	2001/09/07 17:35:16	1.56
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner2.cpp,v 1.55 2001/08/29 17:37:00 tng Exp $
  + * $Id: XMLScanner2.cpp,v 1.56 2001/09/07 17:35:16 tng Exp $
    */
   
   
  @@ -993,7 +993,25 @@
                   if (charOpts == XMLElementDecl::SpacesOk)
                       fDocHandler->ignorableWhitespace(rawBuf, len, false);
                   else if (charOpts == XMLElementDecl::AllCharData)
  -                    fDocHandler->docCharacters(rawBuf, len, false);
  +                {
  +                    if (fGrammar->getGrammarType() != Grammar::SchemaGrammarType)
  +                    {
  +                        fDocHandler->docCharacters(rawBuf, len, false);
  +                    }
  +                    else
  +                    {
  +                        // The normalized data can only be as large as the
  +                        // original size, so this will avoid allocating way
  +                        // too much or too little memory.
  +                        XMLBuffer toFill(len+1);
  +
  +                        // normalize the character according to schema whitespace facet
  +                        DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
  +                        ((SchemaValidator*) fValidator)->normalizeWhiteSpace(tempDV, rawBuf, toFill);
  +
  +                        fDocHandler->docCharacters(toFill.getRawBuffer(), toFill.getLen(), false);
  +                    }
  +                }
               }
           }
            else
  @@ -1016,7 +1034,7 @@
                           // The normalized data can only be as large as the
                           // original size, so this will avoid allocating way
                           // too much or too little memory.
  -                        XMLBuffer toFill(toSend.getLen()+1);
  +                        XMLBuffer toFill(len+1);
   
                           // normalize the character according to schema whitespace facet
                           DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
  
  
  

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