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 ha...@informatiefabriek.nl on 2002/03/19 10:10:53 UTC

parse std::string (xml in string)

Hi all,

How is it possible to parse the contents of a normal std::string...?

example:

01:     string myString ="<?xml 
version=/"1.0/"?><test><blah>blah</blah></test>"; // or something....
02:     try {
03:             XMLPlatformUtils::Initialize();
04:         } catch (XMLException& e) {
05:             cerr << "Error during init!" << endl
06:                  << "Message: " << e.getMessage() << endl;
07:         }
08: 
09:         SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
10:         SAX2ElementHandler myHandler;
11:         parser->setContentHandler(&myHandler);
12:         parser->setErrorHandler(&myHandler);
13: 
14:         try {
15:             parser->parse(....?????..........); // What to put here? 
myString does not work... 
16:         } catch (const XMLException& e) {
17:             cerr << "Error during parse..." << endl;
18:        } catch (...) {
19:             cerr << "Other error..." << endl;
20:         }


So my problem is what to do on line 15...

Many thanks for your help!

Harm de Laat
Informatiefabriek
The Netherlands