Hi Norm,

I was planing on using SAX instead of DOM since everything I read said that
DOM had significant overhead when compared to SAX.  And the requirement here
is speed above all else.  (And the Java code I'm implementing in C++ was
written using SAX as well.)

So I guess my real question is this.
Even though Java uses DefaultHandler for SAX, does the C++ version of this
library support using the DefaultHandler for SAX?

Curtis

-----Original Message-----
From: Norman Samuelson [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 1:35 PM
To: [EMAIL PROTECTED]
Subject: Re: Xerces 2.3.0 question for C++


At 10:38 AM 12/12/2003, you wrote:
>I have a Java Program using Xerces & I need to convert the Xerces stuff
into
>C++ so that our C++ program can reuse the same code.
>
>But I can't seem to get anything using the DefaultHandler class to work.
>The XML document is passed to me via a CORBA call, so that it is already in
>memory.  But the "Parser" class doesn't seem to work with the
DefaultHandler
>in this case.
>
>I looked at the source code in your examples & it seems that DefaultHandler
>only works with XML read in from a file.  Is this correct?  Is there a way
>to do this without a file?  Or must I convert the program to use the more
>limited HandlerBase class?  (I have gotten my own stub program to work with
>this class)
>
>The sample code I was using to kick of the parse was:
>
>const char * xml = <the xml document>
>SAX2XMLReader * parser = XMLReaderFactory::createXMLReader ();
>parser->setContextHandler (this);
>parser->parse (xml);
>
>But none of the methods in the DefaultHandler class ever get called!
>(startElement, characters, etc.)
>
>Curtis

I am using Xerces-c in a way similar to what you are doing.  Here is the
code
I use, from the time I have read the incoming XML into a buffer  (a char*)
named inputFileStream with length inputStreamSize:


>    /* Initialize the parse module */
>    XMLPlatformUtils::Initialize();
>    XercesDOMParser *parser = new XercesDOMParser;
>    DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter() ;
>    /* create a MemBufInputSource to describe
>     * the buffer being passed to the parser */
>    MemBufInputSource* memBufIS = new MemBufInputSource (
>       (const XMLByte*)inputFileStream, inputStreamSize,
>       fileName, false) ;
>    parser->setErrorHandler(errReporter) ;
>    bool errorsOccured = false;
>
>    try {
>       parser->parse(*memBufIS);
>    }




- Norm -

Moderation in all things, including moderation.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to