Hi daniel,
For instance I'm using xerces_2_4.

You are using DefaultHandler and I'm trying to use
handlerbase. The reason for that is the following
method EndElement. It doesn't display anything in my
case. However start element display properly all the
elements.
My idea is only to display some elements, not all of
the elements that are found in the file that's why i
want to modify endElement.
If I use DefaultHandler it runs but still endElement
is not displayed. Did you try to display the
endElement like below?

void Xml::endElement(const XMLElementDecl &  elemDecl,
const unsigned int      urlId,  const bool isRoot, const
XMLCh *const elemPrefix)
{
    
    std::cout << "Found end element:" <<
XMLString::transcode(elemPrefix) << std::endl;
    
}
 

--- Gr�ndal_Daniel <[EMAIL PROTECTED]> a �crit
: > Hi!
> 
> I'm doing roughly the same thing as you are:
> 
> ----------------------------------------------
> class TestAppHandler : public DefaultHandler
> {
>  public:
>   TestAppHandler ();
>   virtual ~TestAppHandler();
>   void startElement(const XMLCh* const uri,
>            const XMLCh* const localname,
>            const XMLCh* const qname,
>            const Attributes& attributes);
>   void endElement(const XMLCh* const uri,
>          const XMLCh* const localname,
>          const XMLCh* const qname);
>   void characters(const XMLCh *const chars, const
> unsigned int length);
> -----------------------------------------------
> 
> I have no problem over loading the function
> endElement() and then to register
> an object of type TestAppHandler as a
> contenthandler.
> 
> ---------------------------------------------
> parser = XMLReaderFactory::createXMLReader();
> TestAppHandler handler;
> parser->setContentHandler(&handler);
> --------------------------------------------
> 
> I use Xerces 2.3.0 if that should matter?
> 
> //daniel
> 
> 
> 
> David ---  (2004-03-16  00:17):
> >Hello,
> >Going through the doc i noticed that EndElement
> >requires the implementation of a handlerbase.
> >However when I use a handlerbase in my code in got
> an
> >error while using SAX2XMLREADER. It complains that
> >setContentHandler requires a contenthandler.
> However
> >my XMLhandler is a HandlerBase.
> >If I use DefaultHandler instead of HandleBase in
> Xml.h
> >it works but then the endElement method is not
> >available. Can anybody help??
> >
> >Error at execution:
> >
> >[EMAIL PROTECTED]:XmlXercesFactory>make
> >g++ Xml.cpp -c -o Xml.o
> >g++ SaxParser.cpp -c -o SaxParser.o
> >SaxParser.cpp: In member function `virtual void
> >SaxParser::ParseFile(char*)':
> >SaxParser.cpp:58: error: no matching function for
> call
> >to `
> >
>
>xercesc_2_4::SAX2XMLReader::setContentHandler(Xml*)'
>
>/usr/local/include/xercesc/sax2/SAX2XMLReader.hpp:304:
> >error: candidates are:
> >   virtual void
> >
>
>xercesc_2_4::SAX2XMLReader::setContentHandler(xercesc_2_4::ContentHandler*)
> >make: *** [SaxParser.o] Error 1
> >>
> >
> >#FILES#
> >
> >#Xml.h
> >
> >
> >class xml : public HandlerBase {
> >
> >public:
> >Xml()
> >virtual ~Xml()
> >
> >###Here all the handler methods
> >
> >}
> >
> >#
> >in SaxParser.cpp
> >void SaxParser::ParseFile(char *xmlFile)
> >{
> >    std::cout <<"Trying to parse "<< xmlFile <<
> "..."
> ><< std::endl;
> >
> >   Xml handler;
> >
> >    c_parser->setErrorHandler(&handler);
> >    c_parser->setContentHandler(&handler);
> >
> >
> >    try {
> > c_parser->parse(xmlFile);
> >    }
> >    catch (XMLException &e){
> > std::cout << "Error parsing file "<<
> >Error(e.getMessage()) << std::endl;
> > exit (-1);
> >    }
> >  ....
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >Yahoo! Mail : votre e-mail personnel et gratuit qui
> vous suit partout !
> >Cr�ez votre Yahoo! Mail sur
> http://fr.benefits.yahoo.com/
> >
> >Dialoguez en direct avec vos amis gr�ce � Yahoo!
> Messenger !T�l�chargez Yahoo!
> Messenger sur http://fr.messenger.yahoo.com
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> 
>
__________________________________________________________
> RFV Data/Produktenheten     E-post:
> [EMAIL PROTECTED]
> Daniel Gr�ndal              Tfn: 060-187126
> S:a J�rnv�gsgatan 41        Mobil: 070-3016517
> 851 93 Sundsvall            Fax: 060-147870
>
__________________________________________________________
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>  


        

        
                
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Cr�ez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis gr�ce � Yahoo! Messenger !T�l�chargez Yahoo! 
Messenger sur http://fr.messenger.yahoo.com

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

Reply via email to