Re: [xml] how to validate xml with external schema

On Fri, Jan 26, 2007 at 06:30:17PM +0100, xjuri volny cz wrote:
Hi everybody,
does anybody know the way, how to validate XML document with XML schema
given as a parametr using libxml2? I know how to validate XML document
which includes schema adress, viz.
But I need some functionality like:

int validate (xml_document, xsd_schema);

I have to validate it in my application, so I can not use xmllint. I
would expact using libxml2 function xmlSchemaNewValidCtxt(schema), but


as I read this function should be called with NULL parametr.


You need first to compile a schemas. Then once you have a compiled schemas
you can use it to validate documents. Read testSchemas.c from the distribution
to see a full example.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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