Hi Alberto! Thanks SO MUCH for this information, I will try it right now and will let you know how it works. I hadn't seen this information in any Xerces documentation (at least that I can remember).
Best regards, --Carolina -----Original Message----- From: Alberto Massari [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 5:58 PM To: [EMAIL PROTECTED] Subject: RE: Validating against DTD in memory (Xerces C++ 2.5.0) Hi Carolina, At 17.05 15/09/2004 -0400, Carolina Garcia-Paris wrote: >I posted this message yesterday but haven't gotten a response yet. > >The bottomline is... has anyone gotten XercesDOMParser::loadGrammar() to >work for loading a DTD grammar in memory and then use it to parse XML files >against it? See my code below. Any hints/recommendations will be greatly >appreciated. The problem is that DTDs are cached using their system id, but your XML files don't specify one, so they cannot be retrieved back. The only solution is to use a custom XMLValidator. Try starting with this code #include <xercesc/validators/common/Grammar.hpp> #include <xercesc/validators/DTD/DTDValidator.hpp> ... DOMParser dtdParser; MemBufInputSource dtdsrc(dtdsource, inputdtd.length(), "VoiceXML"); Grammar* pDTD=dtdParser.loadGrammar(dtdsrc, Grammar::DTDGrammarType, true); DTDValidator dtdValidator; dtdValidator.setGrammar(pDTD); DOMParser VxmlParser(&dtdValidator); VxmlParser.setValidationScheme(DOMParser::Val_Always); VxmlParser.parse(...) Hope this helps, Alberto --------------------------------------------------------------------- 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]