Hello,

I want to validate my XML-Files against a specific DTD-File. Because every File shoul 
be validated with the same DTD-File I tell the parser the location of the DTD with the 
loadGrammar function. It seems he found the DTD but by parsing the XML-File every 
Element and Attribute throws an error.

Can somebody help me???

Here is the part of the programm, where the parser is build:

xercesc::XercesDOMParser::ValSchemes valScheme = xercesc::XercesDOMParser::Val_Always;

xercesc::XercesDOMParser *parser = new xercesc::XercesDOMParser;
parser->setValidationScheme(valScheme);
parser->setDoNamespaces(false);
parser->setDoSchema(false);
parser->setValidationSchemaFullChecking(true);


//set an ErrorHandler
DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
parser->setErrorHandler(errReporter);


const char* xmlFile = filename.c_str();

try
{
// Load grammar and cache it
parser->resetCachedGrammarPool();

parser->loadGrammar("/amd/callisto/users/wbsstud01/klienema/personal.dtd", 
xercesc::Grammar::DTDGrammarType, false);

// enable grammar reuse
parser->useCachedGrammarInParse(true);
parser->cacheGrammarFromParse(true);

//parse the file and report the errors
parser->parse(xmlFile);
int errorCount = parser->getErrorCount();
cerr << errorCount << " errors" << endl;
cerr << "success" << endl;
}




here is some part of the outputed errors:

Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml", line 144, 
column 47
Message: Attribute 'deg' is not declared for element 'Axis'
Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml", line 144, 
column 66
Message: Attribute 'abs_deg' is not declared for element 'Axis'
Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml", line 144, 
column 80
Message: Attribute 'rel_deg' is not declared for element 'Axis'
Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml", line 150, 
column 24
Message: Unknown element 'VerbalDescriptions'
Error at file "/amd/callisto/users/wbsstud01/klienema/fuenflochleiste.xml", line 151, 
column 22


Thx

Kai Lienemann
____________________________________________________________________
Der WEB.DE Virenschutz schuetzt Ihr Postfach vor dem Wurm Sober.A-F!
Kostenfrei fuer FreeMail Nutzer. http://f.web.de/?mc=021158


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

Reply via email to