Enda,
the MemBufInputSource can be used directly with the XercesDOMParser; if you want to use the W3C DOM parser, you will have to wrap it in a Wrapper4InputSource

Wrapper4InputSource wrap(memBufIS, false); // use true if you want the wrapper to delete the InputSouce automtically
xercesc::DOMDocument* xmlDoc = parser->parse(wrap);

Alberto

At 11.56 25/01/2007 +0000, Mannion, Enda wrote:
Are you sure this works for DOM also, I know the sample I am following works for SAX.

But when I pass *memBufIS as a parameter to the parse function (last line of code here) I get an error, it is looking for an object of type DOMInputSource not MemBufInputSource.

MemBufInputSource is inherited from InputSource not DOMInputSource

Am I using the right parse function?


/////////----------------------------------------------------------------------------------------------------------------//
MemBufInputSource* memBufIS = new MemBufInputSource((const XMLByte*)info.c_str(), strlen(info.c_str()), "anytext", false);

bool                       doNamespaces       = false;
bool                       doSchema           = false;
bool                       schemaFullChecking = false;

// Instantiate the DOM parser.
static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS); DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);

parser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces);
parser->setFeature(XMLUni::fgXercesSchema, doSchema);
parser->setFeature(XMLUni::fgXercesSchemaFullChecking, schemaFullChecking);

xercesc::DOMDocument* xmlDoc = parser->parse(*memBufIS);     ß this fails

/////////----------------------------------------------------------------------------------------------------------------//


Thanks for all your help so far I think I am very close to parsing my Document at this stage.

Enda



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

Reply via email to