[xml] xml schema





hello,

i am new to the mailinglist so please be kind if i ask questions that were
already discussed.

i want to validate a given xml-file, using an schema-file. i already read that
support for schema is not ready but i gave it a try...


code:

void xmlErrorFunc(void *ctx, const char *msg)
{
    fprintf(stderr, "ERROR: %s\n", msg);
}

void xmlWarningFunc(void *ctx, const char *msg)
{
    fprintf(stderr, "Warning: %s\n", msg);
}

int main(int argc, char **argv)
{
    xmlSchemaParserCtxt *ctxt;
    void **ctx;
    xmlDoc *doc = NULL;
    xmlNode *root = NULL;

    if (argc != 2) return(1);

    /*
     * Initialize the library and check potential ABI mismatches
     * between the version it was compiled for and the actual shared
     * library used.
     */
    LIBXML_TEST_VERSION
    
    ctxt = xmlSchemaNewParserCtxt(argv[1]);
    xmlSchemaGetParserErrors(ctxt, &xmlErrorFunc, &xmlWarningFunc, ctx);
    xmlSchemaFreeParserCtxt(ctxt);
}

that doesn't work. gcc tells me that there is a pointer mismatch for the 2nd and
3rd arument of xmlSchemaGetParserErrors...

did i use the functions right? (i mean corresponding to there purpose)
what do i have to do to make it work?
do you have a better solution than schemas? (i want to  describe types and the
structure of the file)

thanks a lot for your help!




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