xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Buck" <rb...@mathworks.com>
Subject SAX error messages not printing out in all flavors of UNIX
Date Thu, 06 Feb 2003 23:11:06 GMT
More information:

When I take ICU out of the picture I get my error messages.

Has anyone tried the combination of ICU 2.2 with Xerces-C 2.1? If so,
could I inquire if there was anything special you did to get the
combination to work?

Bob

> -----Original Message-----
> From: Robert Buck [mailto:rbuck@mathworks.com] 
> Sent: Thursday, February 06, 2003 4:33 PM
> To: xerces-c-dev@xml.apache.org
> Subject: Help: SAX error messages not printing out in all 
> flavors of UNIX
> 
> 
> Hi,
> 
> I have linked Xerces-C against ICU. I have a sample 
> reproducible test case where the SAX exception message is 
> blank for UNIX only; windows works just fine. Can someone 
> provide some insight as to what may be going on.
> 
> I have done the following:
> 
> 1. Checked that ICU_DATA is set correctly.
> 2. Set up LD_LIBRARY_PATH correctly.
> 3. Built ICU with Xerces using the two step manual process 
> outlined at the Xerces-C web site.
> 
> Here is the test case on Solaris:
> 
> Compile:
> 
> CC -c main.cpp -libmil -mt -DPIC -KPIC main.cpp 
> -I../icu-package/release/include 
> -I../xerces-c-package/include -I/usr/dt/include -xO4 -xlibmil 
> -g -dalign -xlibmieee -mt -KPIC -xwe
> 
> Link:
> 
> CC -i -mt -o test main.o -mt -L/usr/lib 
> -L../icu-package/release/lib -L../xerces-c-package/lib 
> -lxerces-c -licudata -licuuc -lustdio -licui18n -lCrun -lCstd -lc -ldl
> 
> ###########################################################
> 
> #include <assert.h>
> #include <stdio.h>
> #include <typeinfo>
> #include <iostream>
> using std::cout;
> using std::endl;
> 
> #include <unicode/uloc.h>
> #include <unicode/uclean.h>
> #include <unicode/locid.h>
> #include <unicode/unistr.h>
> #include <unicode/ustream.h>
> 
> #include <functional>
> 
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/sax2/XMLReaderFactory.hpp>
> #include <xercesc/sax2/DefaultHandler.hpp>
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/util/Transcoders/ICU/ICUTransService.hpp>
> 
> class FileOpsHandler : public DefaultHandler
> {
> public: 
>     FileOpsHandler();
>     ~FileOpsHandler();
>     void warning(const SAXParseException&);
>     void error(const SAXParseException&);
>     void fatalError(const SAXParseException&);
> private:
> };
> 
> FileOpsHandler::FileOpsHandler()
> {
> }
> 
> FileOpsHandler::~FileOpsHandler()
> {
> }
> 
> void dumpParseException(const char* typeErr, const SAXParseException&
> spe)
> {
>     const XMLCh* msgBuf = spe.getMessage();
>     UnicodeString s(true,msgBuf,-1);
>     cout << s << endl;
>     char* message = XMLString::transcode(spe.getMessage());
>     printf("\n%s at line %d, column %d:\n %s\n", typeErr,
>         (int)spe.getLineNumber(), (int)spe.getColumnNumber(), 
> message);
>     delete [] message;
> }
> 
> void FileOpsHandler::warning(const SAXParseException& e)
> {
>     dumpParseException("warning: ", e);
> }
> 
> void FileOpsHandler::error(const SAXParseException& e)
> {
>     dumpParseException("error: ", e);
> }
> 
> void FileOpsHandler::fatalError(const SAXParseException& e)
> {
>     dumpParseException("fatal error: ", e);
> }
> 
> void testFileXMLParserOps()
> {
>     SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
>     parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
>     parser->setFeature(XMLUni::fgXercesDynamic, true);
>     parser->setFeature(XMLUni::fgXercesSchema, true);
>     parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
>     parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, true);
> 
>     FileOpsHandler* handler = new FileOpsHandler();
>     parser->setErrorHandler(handler);
>     try
>     {
>         parser->parse("non_existant_file.xml");
>     }
>     catch (const XMLException& e) 
>     {
>         printf("Unexpected XMLException \n");
>     }
>     catch (const SAXParseException& e) 
>     {
>         dumpParseException("parse exception: ", e);
>     }
>     catch (...)
>     {
>         printf("Unexpected Exception \n");
>     }
> 
>     delete parser;
>     delete handler;
> }
> 
> void initialize()
> {
>     uloc_getDefault();
>     XMLPlatformUtils::Initialize();
> }
> 
> void shutdown()
> {
>     XMLPlatformUtils::Terminate();
>     u_cleanup();
> }
> 
> int main(int argc, char* argv[])
> {
>     initialize();
>     testFileXMLParserOps();
>     shutdown();
> }
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 


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


Mime
View raw message