Hi Alberto,

        I've succeeded to manage setExternalSchemaLocation() to work OK,
but I would much raither like to use loadGrammar(). I've found in mail
archives (
http://www.mail-archive.com/xerces-c-dev@xml.apache.org/msg13604.html )
your response on this topic and I did the same using this code:

MemBufInputSource * is = new MemBufInputSource((const unsigned char
*const)hRes, dwFileLength, "Some text...");

XercesDOMParser * schema = new XercesDOMParser;
Grammar * pSchema = schema->loadGrammar(*is,
Grammar::SchemaGrammarType);
schemaValidator = new SchemaValidator();
schemaValidator->setGrammar(pSchema);

XercesDOMParser * parser = new XercesDOMParser(schemaValidator);
parser->setDoNamespaces(true);
parser->setCreateEntityReferenceNodes(true);  

DOMTreeErrorReporter * errorHandler = new DOMTreeErrorReporter();
parser->setErrorHandler(errorHandler);

parser->setDoSchema(true);
parser->setValidationSchemaFullChecking(true);
parser->setValidationScheme(XercesDOMParser::Val_Always);

parser->parse("C:\\my.xml");

        And when using files I have attached with my previous post, I
got this error:

Fatal Error at file 
C:\my.xml
, line 
1
column 
116
Message: 
An exception occurred! Type:RuntimeException, Message:A DOCTYPE was seen
but the installed validator does not understand DTDs

        What is it? Btw, does input stream ( for loadGrammar() ) have to
end with 0 byte? If not, Is it error if it does?

Thank you,
Milan



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

Reply via email to