You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Jason Jesso <jj...@global-matrix.com> on 2002/02/15 16:10:53 UTC
Re: new xerces libraries
WOW! What a difference!
The program SZ does not move at all.
Before the for loop I initialize the xml platform stuff, inside the loop I call new DOMParser, parse a file, then delete the parser, and so on with the next
loop.
With the older libraries the SZ was increasing by 200K on each iteration.
Thanks for help,
Jason
Global-Matrix
Tinny Ng wrote:
> Jason,
>
> > ld: 0711-224 WARNING: Duplicate symbol:
> > .ostream::operator<<(ostream&(*)(ostream&))
> > ld: 0711-224 WARNING: Duplicate symbol: .ErrorHandler::~ErrorHandler()
> > ld: 0711-224 WARNING: Duplicate symbol: ErrorHandler::~ErrorHandler()
> > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
> > information.
>
> These are just warning, not errors, and can be ignored. These warnings are known, and since they are just warnings and should not impact the application in
> most cases, the priority to fix them is low.
>
> Please try to run your application and see if it's ok or not.
>
> Tinny
>
> Jason Jesso wrote:
>
> > Hi There:
> >
> > Can I get your help with one more thing? I got the v5 compiler now and
> > am trying to compile my program linked against the new xerces
> > libraries, but I still get linker errors. I don't get these errors
> > with the older compiler and xerces libraries. I am not quite sure what
> > is different in the new xerces libraries, since the sample programs
> > doesn't seem to have changed.
> >
> > 0:alpha:jjesso> make
> > xlC -I/global/jjesso/xml4c4_0_0-AIX43_5.02/include
> > -L/global/jjesso/xml4c4_0_0-AIX43_5.02/lib -lxerces-c1_6_0 -o a.out
> > Xml4CTest.cpp DOMTreeErrorReporter.cpp
> > Xml4CTest.cpp:
> > DOMTreeErrorReporter.cpp:
> > ld: 0711-224 WARNING: Duplicate symbol:
> > .ostream::operator<<(ostream&(*)(ostream&))
> > ld: 0711-224 WARNING: Duplicate symbol: .ErrorHandler::~ErrorHandler()
> > ld: 0711-224 WARNING: Duplicate symbol: ErrorHandler::~ErrorHandler()
> > ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
> > information.
> > 0:alpha:jjesso>
> >
> > I have attached my src files (This is just an example I am using to see
> > if those memory leaks go way.). Can you take a quick look? Sorry to
> > bother you like this.
> >
> > Thanks again
> > Jason
> >
> > Global-Matrix
> >
> > -----------------------------
> >
> > The XML4C 4.0 has upgraded its AIX C++ compiler, and the AIX4.3 binary
> > package was built using xlC_r v5. If you are using xlC_r v3, then you
> > will get link error.
> >
> > Tinny
> >
> > ------------------------------------------------------------------------
> > #include <iostream.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #include "dom/DOMString.hpp"
> > #include "sax/SAXParseException.hpp"
> > #include "DOMTreeErrorReporter.h"
> >
> > // Global streaming operator for DOMString is defined in DOMPrint.cpp
> > extern ostream& operator<<(ostream& target, const DOMString& s);
> >
> > void DOMTreeErrorReporter::warning(const SAXParseException&)
> > {
> > //
> > // Ignore all warnings.
> > //
> > }
> >
> > void DOMTreeErrorReporter::error(const SAXParseException& toCatch)
> > {
> > fSawErrors = true;
> > cerr << "Error at file \"" << DOMString(toCatch.getSystemId())
> > << "\", line " << toCatch.getLineNumber()
> > << ", column " << toCatch.getColumnNumber()
> > << "\n Message: " << DOMString(toCatch.getMessage()) << endl;
> > }
> >
> > void DOMTreeErrorReporter::fatalError(const SAXParseException& toCatch)
> > {
> > fSawErrors = true;
> > cerr << "Fatal Error at file \"" << DOMString(toCatch.getSystemId())
> > << "\", line " << toCatch.getLineNumber()
> > << ", column " << toCatch.getColumnNumber()
> > << "\n Message: " << DOMString(toCatch.getMessage()) << endl;
> > }
> >
> > void DOMTreeErrorReporter::resetErrors()
> > {
> > // No-op in this case
> > }
> >
> > ------------------------------------------------------------------------
> > #include <iostream.h>
> > #include "util/XercesDefs.hpp"
> > #include "sax/ErrorHandler.hpp"
> >
> > class DOMTreeErrorReporter : public ErrorHandler
> > {
> > public:
> >
> > DOMTreeErrorReporter() :
> > fSawErrors(false)
> > {
> > }
> >
> > ~DOMTreeErrorReporter()
> > {
> > }
> >
> > // -----------------------------------------------------------------------
> > // Implementation of the error handler interface
> > // -----------------------------------------------------------------------
> > void warning(const SAXParseException& toCatch);
> > 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;
> > }
> >
> > ------------------------------------------------------------------------
> > #include <iostream.h>
> > #include <unistd.h>
> > #include "dom/DOM.hpp"
> > #include "dom/DOM_NodeList.hpp"
> > #include "dom/DOMString.hpp"
> > #include "dom/DOM_DOMException.hpp"
> > #include "parsers/DOMParser.hpp"
> > #include "util/PlatformUtils.hpp"
> > #include "sax/ErrorHandler.hpp"
> > #include "sax/HandlerBase.hpp"
> > #include "DOMTreeErrorReporter.h"
> >
> > ostream& operator<<(ostream& target, const DOMString& toWrite);
> >
> > int
> > main( int ac, char* av[] )
> > {
> > if ( ac != 2 ){
> > cerr << "usage: " << av[0] << " xml file" << endl;
> > return 1;
> > }
> >
> > try
> > {
> > XMLPlatformUtils::Initialize();
> > }
> > catch( const XMLException& e )
> > {
> > cerr << "Error during initialization! :\n"
> > << e.getMessage() << "\n";
> > return 1;
> > }
> >
> > for ( ;; ){
> >
> > DOMParser *parser = new DOMParser;
> > if ( parser == NULL ){
> > cerr << "parser is null" << endl;
> > }
> > cerr << parser << endl;
> > parser->setValidationScheme(DOMParser::Val_Always);
> > DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
> > parser->setErrorHandler(errReporter);
> >
> > //
> > // Parse the XML file, catching any XML exceptions that might propogate
> > // out of it.
> > //
> > bool errorsOccured = false;
> >
> > try
> > {
> > cerr << "Here 1" << " " << av[1] << endl;
> > parser->parse(av[1]);
> > cerr << "Here 2" << endl;
> > int errorCount = parser->getErrorCount();
> > if (errorCount > 0) errorsOccured = true;
> > cerr << "Here 3" << endl;
> > }
> > catch( const XMLException& e )
> > {
> > cerr << "An error occured during parsing file: " << av[1] << endl << "Exception message is: " << endl << DOMString(e.getMessage()) << endl;
> > errorsOccured = true;
> > }
> > catch (const SAXParseException& e)
> > {
> > cerr << "An SAXParseException error occured during parsing, got SAXParseException " << DOMString(e.getMessage()) << "\n" ;
> > errorsOccured = true;
> > }
> > catch (...)
> > {
> > cerr << "\nUnexpected exception during parsing: '" << av[1] << "'\n";
> > errorsOccured = true;
> > }
> >
> > if ( errorsOccured || errReporter->getSawErrors() ){
> > cerr << "Parse unsuccessful!" << endl;
> > delete errReporter;
> > delete parser;
> > XMLPlatformUtils::Terminate();
> > return 1;
> > }
> >
> > delete errReporter;
> > delete parser;
> >
> > cout << "Parse successful!" << endl;
> >
> > sleep(1);
> > } /* for */
> >
> > XMLPlatformUtils::Terminate();
> >
> > return 0;
> > }
> >
> > // ---------------------------------------------------------------------------
> > // ostream << DOMString
> > //
> > // Stream out a DOM string. Doing this requires that we first transcode
> > // to char * form in the default code page for the system
> > // ---------------------------------------------------------------------------
> > ostream& operator<< (ostream& target, const DOMString& s)
> > {
> > char *p = s.transcode();
> > target << p;
> > delete [] p;
> > return target;
> > }
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org