Re: [xml] Validating XML with DTD



Senthil S wrote:

Hi All,
                  I experienced a problem in validating DTD explained as follows:
My problem is:
 I have the code like this:

doc = xmlReadFile("sample.xml", NULL, 0);
dtd = xmlParseDTD(NULL,"sample.dtd" ); cvp = xmlNewValidCtxt(); valid=xmlValidateDtd(cvp, doc, dtd);
                  When the xml file is not matchng with the DTD,  function 'xmlValidateDtd' is returning 
value 0 and the reason for invalidity is printed in the console.
My project needs this error message to be returned to a calling function.  Please help me out to resolve the 
issue.

Thanks,
Senthil

Ever seen the xmlValidityErrorFunc or xmlValidityWarningFunc? Set the cvp->error and/or cvp->warning callbacks before you call xmlValidateDtd.

Ciao,
Igor



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