Hi,
did the answer to " Validation with a default DTD" answer your
question?
Gareth
On Fri, 28 May 2004, Kai Lienemann wrote:
> I psoted this question some weeks ago and got no answer. But I think it
> can't be so difficult, although I find no solution. Maybe somebody had the
> same problem?
> So here is the question:
>
> 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 or give me a hint???
>
> 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);
>
>
> file://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);
>
> file://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
>
> ----
> Artificial Intelligence Group
> Faculty of Technology
> University of Bielefeld
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
Gareth Reakes, Managing Director Parthenon Computing
+44-1865-811184 http://www.parthcomp.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]