[xml] How to use libxml2 and RelaxNG validation?


I' m trying to check my xslt file version by using libxml2 and its xmlTextReaderRelaxNGValidate function. The RNG file that I give is "xslt.rng" which describe the XSLT 1.0 specification. I would like to make a programm which tells me "yes" if my xslt file is in V1.0 and "no" either.
I suppose I do it the wrong way because the result that I print is "(null)"
I can't find any tutorial about this.
Can someone help me?!

Here's my program :

#include <string.h>
#include <stdio.h>
#include <libxml/xmlreader.h>
#include <libxml/xmlmemory.h>

extern int xmlLoadExtDtdDefaultValue;

int testerVersion() {
    xmlLoadExtDtdDefaultValue = 1;

    const char* xsltfile = "myfile.xslt";
    const char* rngfile = "xslt.rng";
    xmlTextReaderPtr ReaderP = NULL;

    ReaderP = xmlReaderForFile(xsltfile,NULL,1);
    int    retour = xmlTextReaderRelaxNGValidate(ReaderP,rngfile);
    printf("%s", retour);
    return retour;

Thank you


300 Mo gratuits sur CaraMail : Cliquez ici pour en profiter!

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