At 04.41 18/12/2006 -0800, appleGuy wrote:

Ok,

I cant seem to see XMLStringPool in the docs, there is a
XMLSyncronisedStringPool...

I guess it was treated as an internal helper class, as it is explicitly removed from the doc generation step (while XMLSyncronisedStringPool is a more recent class that escaped the check...). You can use XMLSyncronisedStringPool (that derives from XMLStringPool), or just include xercesc/util/StringPool.hpp and use XMLStringPool...

Alberto

???

-Alex


Alberto Massari wrote:
>
> At 15.05 17/12/2006 -0800, appleGuy wrote:
>
>>Hi,
>>
>>Ive been getting there with this Sax buisness...
>>
>>Now my handler class is on the way (the problem I had earlier is sorted)
>>
>>However How do I make comparisons efficently using SAX...I mean when it
get
>>the tag, i need to compare it & find the right variable to assign the
>>character data too (the data between the tags)
>
> I would add to my handler class an instance of type XMLStringPool,
> initialize it by adding to it the names I am interested in (using
> addOrFind), then use getId to convert the node name into one of these
> known ids.
>
> Alberto
>
>
>>Cheers
>>Alex
>>
>>
>>appleGuy wrote:
>> >
>> > Ok,
>> >
>> > Im going to include my code for this problem.
>> > I get an error when the parse function is called:
>> > parser->parse(XMLfile)....Ive got no idea why
>> >
>> > Also this was formed from the SaxCount Code included with the Xerces
>> > distro.
>> >
>> > Currently I dont see it doing anything. I need to be able to change
>> > variable & containers in the DocumentHandler Class
>> >
>> > Cheers
>> > Alex
>> >
>> >
>> > bool prjLoad::loadXML_prj(char *prj_filename){
>> >       //Start XML Xerces Framework
>> >       try {
>> >             XMLPlatformUtils::Initialize();
>> >         }
>> >         catch (const XMLException& toCatch) {
>> >             char* message = XMLString::transcode(toCatch.getMessage());
>> >             cout << "Error during initialization! :\n"
>> >                  << message << "\n";
>> >             XMLString::release(&message);
>> >                       return false;
>> >         }
>> >
>> >               //Create New Parser (SAX)
>> >         SAXParser* parser = new SAXParser();
>> >
>> >               //File Input Validation
>> >         parser->setDoValidation(true);
>> >         parser->setDoNamespaces(true);
>> >
>> >               //Create our SAX handler object and install it on
>> the parser (Doc &
>> > Error Handler)
>> >               //Using Project as Handler
>> >               parser->setDocumentHandler(prj);
>> >               parser->setErrorHandler(prj);
>> >
>> >               //Load File through Xerces
>> >               XERCES_STD_QUALIFIER ifstream xmlFileHandle;
>> >         xmlFileHandle.open(prj_filename);
>> >
>> >               //Load Each Line From File To Array xmlFile
>> >               bool flag = true;
>> >               while (flag == true)
>> >     {
>> >         char token[1000];
>> >         //Set array to zeros
>> >         memset(token,0,sizeof(token));
>> >
>> >               //Sequential Search
>> >               if(!(xmlFileHandle.eof())){
>> >                       xmlFileHandle.getline(token, sizeof(token));
>> >
>> >                       //Check If Line Contains Anything
>> >                       if(!(token))
>> >                               continue;
>> >                       else {
>> >                               //Load into New Derived Variable
>> for overloading & Safety
>> >                               const char *XMLfile = token;
>> >
>> >                               //Debug
>> >                               cout << "Parsing: " << XMLfile << endl;
>> >
>> >                               //ERROR WIPE -> NEEDS IMPLIMENTING
>> >
>> >                               try {
>> >                                       parser->parse(XMLfile);
>> >                               }
>> >                               catch(int debug /*Use Exception in
>> class*/){
>> >                                       cout << "ERROR OCCURED" << endl;
>> >                               }
>> >
>> >                       }
>> >
>> >
>> >               }
>> >               //ELSE STATEMENT FOR EOF-> Set Flag to false
>> therefore exiting while
>> > loop
>> >               else
>> >                       flag = false;
>> >
>> >
>> >       }
>> >
>> >               return true;
>> > }
>> >
>> >
>> > appleGuy wrote:
>> >>
>> >> Its Ok,
>> >>
>> >> I needed to inheirt from the handlerbase class
>> >>
>> >>
>> >> Cheers
>> >> ALEX
>> >>
>> >>
>> >>
>> >> appleGuy wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> Ive finally started to get going using Sax. Now im using the Samples
>> to
>> >>> help coding my own project.
>> >>>
>> >>> Looking at Sax Count, they seem to have created their own handler
>> class
>> >>> (saxcounthandler):
>> >>>
>> >>> SAXCountHandlers handler;
>> >>>     parser->setDocumentHandler(&handler);
>> >>>     parser->setErrorHandler(&handler);
>> >>>
>> >>> How can they do this as The type needed in setDocumentHandler needs
>> to
>> >>> be type DocumentHandler.
>> >>>
>> >>> When I try to use my custom class as a handler, it gives an
>> error...what
>> >>> is special about the SaxCountHandlers..?
>> >>>
>> >>> Ive used pointers,. they have dereferenced an object, surely im doing
>> >>> the same thing?
>> >>>
>> >>> Many Thanks
>> >>> Alex
>> >>>
>> >>> p.s: Also by DocumentHandler, what does this do exactly. Im thinking
>> its
>> >>> the controller for the parsing. I.e you can use the parsed data to
>> >>> modify the handler and visa-versa
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>>--
>>View this message in context:
>>http://www.nabble.com/Parsing-Using-SAX-tf2835675.html#a7921219
>>Sent from the Xerces - C - Users mailing list archive at Nabble.com.
>
>
>

--
View this message in context: http://www.nabble.com/Parsing-Using-SAX-tf2835675.html#a7928122
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to