Stefan Weigert wrote:
> 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!
OK, I'll try to be kind :-). You have gotten confused between function
names (an easy mistake to make because of the large number of
similarly-named functions in the library). Instead of the function
"xmlSchemaGetParserErrors" (which provides information about what are the
current handlers), you want to use "xmlSchemaSetParserErrors" (which
"sets" which handlers to use). Note that gcc was trying to tell you this
- a good example why one should pay close attention to warnings.
Bill
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml