Re: [xml] Need help on API xmlSchemaIsValid()...



Hi,

On Wed, 2005-07-13 at 16:09 +0530, Sameer Oak wrote:
Kindly guide me how to use the API

int xmlSchemaIsValid(xmlSchemaValidCtxtPtr ctxt);

xmlSchemaIsValid() just says if a previous validation succeeded or
not.

What I can see I need to have a pointer "ctxt" to type
xmlSchemaValidCtxt. But how can initialize this pointer
I'll have a string buffer(i mean char *) which will contain the
xml-payload.
This buffer somehow has to be converted to ctxt or there must be some
member of xmlSchemaValidCtxt to which I'll have to memcpy() the string
buffer.

First create a W3C XML Schema parser context with:
 - e.g. xmlSchemaNewParserCtxt

then parse & compile the schema with:
 - xmlSchemaParse

then create a validation context for the compiled schema with:
 - xmlSchemaNewValidCtxt

then validate your in-memory document with:
 - xmlSchemaValidateStream 
   (Have a look at the code of xmlSchemaValidateFile(), which
    uses xmlSchemaValidateStream)

OR, first parse your in-memory document and create a node-tree with:
 - xmlReadMemory
and then validate the node-tree with:
 - xmlSchemaValidateDoc 

XML Schema API:
  http://www.xmlsoft.org/html/libxml-xmlschemas.html

Parser API:
  http://www.xmlsoft.org/html/libxml-parser.html


Regards,

Kasimier



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