Re: [xml] libxml2 does xmlSchemaValidateDoc() support xml schema extensions?



Hi Piotr


One thing I would suggest is NOT releasing any of the resources
associated with the schema before validation (do that after, instead).

   //xmlSchemaFree(schema); causes crash when we try to use validCtxt
   xmlSchemaFreeParserCtxt(parserCtxt);
   xmlFreeDoc(schemaDoc);

   //
http://www.xmlsoft.org/html/libxml-xmlschemas.html#xmlSchemaValidateDoc
   int error = xmlSchemaValidateDoc(validCtxt.validCtxt, doc);       

   if (error == 0) {
       NSLog(@"document is a valid instance of %@", schemaFileName);
       ret = YES;
   } 


I'll try making the change you suggest. The reason I structured the code this way was that I am working on a 
transactional system with over 100 xsd files. I load the validCtxt and cache them as needed. I tried to free 
up all the unnecessary memory to keep my foot print as small as possible.

Thanks

Andy



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