Re: [xml] validation



David Meyer wrote:

I'm using the validation feature. But when I got a validation error,
xmlParseFile() does not return NULL - how can I check this up?


Try to do this via a ParserCtxt, where you can separately parse the
file and validate it afterwards:


xmlDocPtr doc, res;
xmlDtdPtr theDtd;


xmlParserCtxtPtr ctxt;
xmlValidCtxt cvp;

ctxt=xmlCreateFileParserCtxt(argv[2]);

theDtd=xmlParseDTD(NULL,argv[3]);

 xmlParseDocument(ctxt);

cvp.userData= (void *)stderr;
cvp.error= (xmlValidityErrorFunc) fprintf;
cvp.warning= (xmlValidityWarningFunc) fprintf;

if (!xmlValidateDtd(&cvp,doc,theDtd))
  fprintf(stderr,"Document does not validate!\n");



--
Heiko W. Rupp
Project Management
WiredMinds Informationssysteme GmbH
Wilhelmsplatz 11
D-70182 Stuttgart

Email: Heiko Rupp WiredMinds de            Phone: +49 711 49048-232
Mobile: +49 172 7471 438                   Fax:   +49 711 49048-111





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]