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

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. http://groups.google.cz/group/comp.text.xml/browse_thread/thread/54d101bb8764068f/56e5ca1fdd408556?lnk=st&q=xmlSchemaValidateDoc&rnum=11&hl=cs#56e5ca1fdd408556
> 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

 yes

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

  No.

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.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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