Thanks Kasimier, it is working now.

Regards,

Kasimier Buchcik writes:

Hi,

Samuel D�az Garc�a wrote:
Well, I validate an XML document (in my app) in two steps:
  1) With the XML internal XSD.
  2) With a local XSD.

�any help with the first step as I want?
[...]

In case the information that the validation context needs to
be created with a NULL value for the @schema argument was not
explitic enough, you may try the following function sketch to
validate as you want in 1). It will gather the XML Schema documents
specified by the xsi information and validate against them.

{
 int res;
 xmlDocPtr doc;
 xmlSchemaValidCtxtPtr xsdCtxt;

 /*
 * Load the document.
 */
 doc = xmlReadFile(BAD_CAST "foo.xml", NULL, 0);
 if (doc == NULL)
   return (-1);

 /*
 * Create the validation context with NULL as the
 * @schema argument.
 */
 xsdCtxt = xmlSchemaNewValidCtxt(NULL);
 if (xsdCtxt == NULL) {
   xmlFreeDoc(doc);
   return (-1);
 }

 /*
 * Validate the document.
 */
 res = xmlSchemaValidateDoc(xsdCtxt, doc);

 xmlSchemaFreeValidCtxt(xsdCtxt);
 xmlFreeDoc(doc);

 return (res);
}


Cheers,

Kasimier



Samuel D�az Garc��a Director Gerente ArcosCom Wireless, S.L.L.

mailto:[EMAIL PROTECTED]
http://www.arcoscom.com
m�vil: 651 93 72 48
tlfn/fax: 956 70 13 15


_______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml

Reply via email to