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 Kai heiko Lienemann <Xe...@web.de> on 2004/05/10 16:01:03 UTC

Only errors by validating a well-formed XML-File against a DTD

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: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org