You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2001/06/03 21:21:42 UTC

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

jberry      01/06/03 12:21:42

  Modified:    c/src/internal XMLScanner.cpp XMLScanner.hpp
  Log:
  Add support for tracking error count during parse; enables simple parse without requiring error handler.
  
  Revision  Changes    Path
  1.42      +13 -1     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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- XMLScanner.cpp	2001/05/28 20:55:02	1.41
  +++ XMLScanner.cpp	2001/06/03 19:21:39	1.42
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner.cpp,v 1.41 2001/05/28 20:55:02 tng Exp $
  + * $Id: XMLScanner.cpp,v 1.42 2001/06/03 19:21:39 jberry Exp $
    */
   
   
  @@ -811,6 +811,9 @@
   
       // And invalidate any tokens by bumping our sequence number
       fSequenceId++;
  +    
  +    // Reset our error count
  +    fErrorCount = 0;
   }
   
   
  @@ -944,6 +947,9 @@
   //
   void XMLScanner::emitError(const XMLErrs::Codes toEmit)
   {
  +    //	Bump the error count
  +    ++fErrorCount;
  +    
       if (fErrorReporter)
       {
           // Load the message into a local for display
  @@ -992,6 +998,9 @@
                               , const XMLCh* const        text3
                               , const XMLCh* const        text4)
   {
  +    //	Bump the error count
  +    ++fErrorCount;
  +    
       if (fErrorReporter)
       {
           //
  @@ -1043,6 +1052,9 @@
                               , const char* const         text3
                               , const char* const         text4)
   {
  +    //	Bump the error count
  +    ++fErrorCount;
  +    
       if (fErrorReporter)
       {
           //
  
  
  
  1.20      +13 -0     xml-xerces/c/src/internal/XMLScanner.hpp
  
  Index: XMLScanner.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner.hpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XMLScanner.hpp	2001/05/28 20:55:02	1.19
  +++ XMLScanner.hpp	2001/06/03 19:21:40	1.20
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: XMLScanner.hpp,v $
  + * Revision 1.20  2001/06/03 19:21:40  jberry
  + * Add support for tracking error count during parse; enables simple parse without requiring error handler.
  + *
    * Revision 1.19  2001/05/28 20:55:02  tng
    * Schema: allocate a fDTDValidator, fSchemaValidator explicitly to avoid wrong cast
    *
  @@ -301,6 +304,7 @@
       bool getStandalone() const;
       const XMLValidator* getValidator() const;
       XMLValidator* getValidator();
  +    int getErrorCount();
       const DTDEntityDecl* getEntityDecl
       (
           const   XMLCh* const    entName
  @@ -701,6 +705,9 @@
       //      This is the currently set validation scheme. It defaults to
       //      'never', but can be set by the client.
       //
  +    //  fErrorCount
  +    //		The number of errors we've encountered.
  +    //
       //  fDoSchema
       //      This flag indicates whether the client code wants Schema to
       //      be processed or not.
  @@ -783,6 +790,7 @@
       SchemaValidator*            fSchemaValidator;
       bool                        fValidatorFromUser;
       ValSchemes                  fValScheme;
  +    int                         fErrorCount;
       bool                        fDoSchema;
       bool                        fSeeXsi;
   
  @@ -914,6 +922,11 @@
   inline bool XMLScanner::getDoSchema() const
   {
       return fDoSchema;
  +}
  +
  +inline int XMLScanner::getErrorCount()
  +{
  +    return fErrorCount;
   }
   
   inline bool XMLScanner::isValidatorFromUser()
  
  
  

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


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

Posted by Dean Roddey <dr...@charmedquark.com>.
Personally, I would have argued for keeping that stuff out of the scanner
and just having the DOMParser and SAXParser install a simple, default error
handler that will keep a counter. It would have been less intrusive to the
core code and would have worked just as well.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"Why put off until tomorrow what you can
put off until the day after tomorrow?"

----- Original Message -----
From: <jb...@apache.org>
To: <xm...@apache.org>
Sent: Sunday, June 03, 2001 12:21 PM
Subject: cvs commit: xml-xerces/c/src/internal XMLScanner.cpp XMLScanner.hpp


> jberry      01/06/03 12:21:42
>
>   Modified:    c/src/internal XMLScanner.cpp XMLScanner.hpp
>   Log:
>   Add support for tracking error count during parse; enables simple parse
without requiring error handler.
>
>   Revision  Changes    Path
>   1.42      +13 -1     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.41
>   retrieving revision 1.42
>   diff -u -r1.41 -r1.42
>   --- XMLScanner.cpp 2001/05/28 20:55:02 1.41
>   +++ XMLScanner.cpp 2001/06/03 19:21:39 1.42
>   @@ -55,7 +55,7 @@
>     */
>
>    /*
>   - * $Id: XMLScanner.cpp,v 1.41 2001/05/28 20:55:02 tng Exp $
>   + * $Id: XMLScanner.cpp,v 1.42 2001/06/03 19:21:39 jberry Exp $
>     */
>
>
>   @@ -811,6 +811,9 @@
>
>        // And invalidate any tokens by bumping our sequence number
>        fSequenceId++;
>   +
>   +    // Reset our error count
>   +    fErrorCount = 0;
>    }
>
>
>   @@ -944,6 +947,9 @@
>    //
>    void XMLScanner::emitError(const XMLErrs::Codes toEmit)
>    {
>   +    // Bump the error count
>   +    ++fErrorCount;
>   +
>        if (fErrorReporter)
>        {
>            // Load the message into a local for display
>   @@ -992,6 +998,9 @@
>                                , const XMLCh* const        text3
>                                , const XMLCh* const        text4)
>    {
>   +    // Bump the error count
>   +    ++fErrorCount;
>   +
>        if (fErrorReporter)
>        {
>            //
>   @@ -1043,6 +1052,9 @@
>                                , const char* const         text3
>                                , const char* const         text4)
>    {
>   +    // Bump the error count
>   +    ++fErrorCount;
>   +
>        if (fErrorReporter)
>        {
>            //
>
>
>
>   1.20      +13 -0     xml-xerces/c/src/internal/XMLScanner.hpp
>
>   Index: XMLScanner.hpp
>   ===================================================================
>   RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner.hpp,v
>   retrieving revision 1.19
>   retrieving revision 1.20
>   diff -u -r1.19 -r1.20
>   --- XMLScanner.hpp 2001/05/28 20:55:02 1.19
>   +++ XMLScanner.hpp 2001/06/03 19:21:40 1.20
>   @@ -56,6 +56,9 @@
>
>    /*
>     * $Log: XMLScanner.hpp,v $
>   + * Revision 1.20  2001/06/03 19:21:40  jberry
>   + * Add support for tracking error count during parse; enables simple
parse without requiring error handler.
>   + *
>     * Revision 1.19  2001/05/28 20:55:02  tng
>     * Schema: allocate a fDTDValidator, fSchemaValidator explicitly to
avoid wrong cast
>     *
>   @@ -301,6 +304,7 @@
>        bool getStandalone() const;
>        const XMLValidator* getValidator() const;
>        XMLValidator* getValidator();
>   +    int getErrorCount();
>        const DTDEntityDecl* getEntityDecl
>        (
>            const   XMLCh* const    entName
>   @@ -701,6 +705,9 @@
>        //      This is the currently set validation scheme. It defaults to
>        //      'never', but can be set by the client.
>        //
>   +    //  fErrorCount
>   +    // The number of errors we've encountered.
>   +    //
>        //  fDoSchema
>        //      This flag indicates whether the client code wants Schema to
>        //      be processed or not.
>   @@ -783,6 +790,7 @@
>        SchemaValidator*            fSchemaValidator;
>        bool                        fValidatorFromUser;
>        ValSchemes                  fValScheme;
>   +    int                         fErrorCount;
>        bool                        fDoSchema;
>        bool                        fSeeXsi;
>
>   @@ -914,6 +922,11 @@
>    inline bool XMLScanner::getDoSchema() const
>    {
>        return fDoSchema;
>   +}
>   +
>   +inline int XMLScanner::getErrorCount()
>   +{
>   +    return fErrorCount;
>    }
>
>    inline bool XMLScanner::isValidatorFromUser()
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-cvs-help@xml.apache.org
>