[xml] Schema validation from API



Hi all,

I´m trying to validate a XML file by schema.xsd

With xmllint, everything is Ok,
xmllint --noout --schema test.xsd test.xml
test.xml validates

How should I make this validation through API ?


reader = xmlReaderForFile(test.xsd , NULL, NULL);

schema_parse = xmlSchemaNewParserCtxt("test.xsd");

schema = xmlSchemaParse(schema_parse);

schema_valid = xmlSchemaNewValidCtxt(schema);

doc = xmlTextReaderCurrentDoc(reader);

res_val = xmlSchemaValidateDoc (schema_valid, doc); //int xmlSchemaValidateDoc  (xmlSchemaValidCtxtPtr ctxt, 
xmlDocPtr doc)


Thank you in advance.
______________________ 
José Miguel García  



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