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/05/04 21:01:13 UTC

cvs commit: xml-xerces/c/samples/DOMPrint DOMPrint.cpp DOMTreeErrorReporter.cpp DOMTreeErrorReporter.hpp

tng         01/05/04 12:01:13

  Modified:    c/samples/DOMPrint DOMPrint.cpp DOMTreeErrorReporter.cpp
                        DOMTreeErrorReporter.hpp
  Log:
  DOMPrint fix.  Check error before continuing.
  
  Revision  Changes    Path
  1.29      +3 -3      xml-xerces/c/samples/DOMPrint/DOMPrint.cpp
  
  Index: DOMPrint.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/samples/DOMPrint/DOMPrint.cpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DOMPrint.cpp	2001/05/03 15:59:29	1.28
  +++ DOMPrint.cpp	2001/05/04 19:01:03	1.29
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DOMPrint.cpp,v 1.28 2001/05/03 15:59:29 tng Exp $
  + * $Id: DOMPrint.cpp,v 1.29 2001/05/04 19:01:03 tng Exp $
    */
   
   
  @@ -424,7 +424,7 @@
       parser->setValidationScheme(gValScheme);
       parser->setDoNamespaces(gDoNamespaces);
       parser->setDoSchema(gDoSchema);
  -    ErrorHandler *errReporter = new DOMTreeErrorReporter();
  +    DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
       parser->setErrorHandler(errReporter);
       parser->setCreateEntityReferenceNodes(gDoCreate);
       parser->setToCreateXMLDeclTypeNode(true);
  @@ -462,7 +462,7 @@
   
   
       // If the parse was successful, output the document data from the DOM tree
  -    if (!errorsOccured)
  +    if (!errorsOccured && !errReporter->getSawErrors())
       {
           DOM_Node doc = parser->getDocument();
           DOMPrintFormatTarget* formatTarget = new DOMPrintFormatTarget();
  
  
  
  1.8       +5 -0      xml-xerces/c/samples/DOMPrint/DOMTreeErrorReporter.cpp
  
  Index: DOMTreeErrorReporter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/samples/DOMPrint/DOMTreeErrorReporter.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMTreeErrorReporter.cpp	2001/05/03 15:59:32	1.7
  +++ DOMTreeErrorReporter.cpp	2001/05/04 19:01:05	1.8
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: DOMTreeErrorReporter.cpp,v $
  + * Revision 1.8  2001/05/04 19:01:05  tng
  + * DOMPrint fix.  Check error before continuing.
  + *
    * Revision 1.7  2001/05/03 15:59:32  tng
    * Schema: samples update with schema
    *
  @@ -110,6 +113,7 @@
   
   void DOMTreeErrorReporter::error(const SAXParseException& toCatch)
   {
  +    fSawErrors = true;
       cerr << "Error at file \"" << DOMString(toCatch.getSystemId())
   		 << "\", line " << toCatch.getLineNumber()
   		 << ", column " << toCatch.getColumnNumber()
  @@ -118,6 +122,7 @@
   
   void DOMTreeErrorReporter::fatalError(const SAXParseException& toCatch)
   {
  +    fSawErrors = true;
       cerr << "Fatal Error at file \"" << DOMString(toCatch.getSystemId())
   		 << "\", line " << toCatch.getLineNumber()
   		 << ", column " << toCatch.getColumnNumber()
  
  
  
  1.5       +39 -15    xml-xerces/c/samples/DOMPrint/DOMTreeErrorReporter.hpp
  
  Index: DOMTreeErrorReporter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/samples/DOMPrint/DOMTreeErrorReporter.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DOMTreeErrorReporter.hpp	2000/03/02 19:53:40	1.4
  +++ DOMTreeErrorReporter.hpp	2001/05/04 19:01:07	1.5
  @@ -1,38 +1,38 @@
   
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -46,7 +46,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -57,6 +57,9 @@
   
   /*
    * $Log: DOMTreeErrorReporter.hpp,v $
  + * Revision 1.5  2001/05/04 19:01:07  tng
  + * DOMPrint fix.  Check error before continuing.
  + *
    * Revision 1.4  2000/03/02 19:53:40  roddey
    * This checkin includes many changes done while waiting for the
    * 1.1.0 code to be finished. I can't list them all here, but a list is
  @@ -89,14 +92,14 @@
       // -----------------------------------------------------------------------
       //  Constructors and Destructor
       // -----------------------------------------------------------------------
  -    DOMTreeErrorReporter()
  +    DOMTreeErrorReporter() :
  +       fSawErrors(false)
       {
       }
   
       ~DOMTreeErrorReporter()
       {
  -    } 
  -
  +    }
   
       // -----------------------------------------------------------------------
       //  Implementation of the error handler interface
  @@ -105,5 +108,24 @@
       void error(const SAXParseException& toCatch);
       void fatalError(const SAXParseException& toCatch);
       void resetErrors();
  +
  +    // -----------------------------------------------------------------------
  +    //  Getter methods
  +    // -----------------------------------------------------------------------
  +    bool getSawErrors() const;
  +
  +    // -----------------------------------------------------------------------
  +    //  Private data members
  +    //
  +    //  fSawErrors
  +    //      This is set if we get any errors, and is queryable via a getter
  +    //      method. Its used by the main code to suppress output if there are
  +    //      errors.
  +    // -----------------------------------------------------------------------
  +    bool    fSawErrors;
   };
   
  +inline bool DOMTreeErrorReporter::getSawErrors() const
  +{
  +    return fSawErrors;
  +}
  
  
  

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