Hi, Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von CAPRON Patrick Gesendet: Donnerstag, 13. April 2006 14:49
> Hi, > I try to use libxml2 to generate an XML file and before creating it, I would like to validate it against an existing schema. > If I use the xmlSchemaValidateDoc function to validate my xmlDocPtr (created with xmlNewDoc, xmlNewNode, xmlDocSetRootElement, etc...) > I get this error message (Document is the name of the root element in my XML document) : > element Document: Schemas validity error : Element 'Document': No matching global declaration available for the validation root. > Then if I first save the file using xmlSaveFileEnc, reopen it by xmlParseFile the xmlDocPtr that I get can be validated against the same schema without any problem... > Has anybody an explanation ? > Must I do something to my xmlDocPtr in order to be able to validate it ? If a serialization/reparsing does help, then I would suspect some namespace related issued in the original node-tree; but this is just a vague guess without looking at you screen. - Check if the namespace-URI (doc->node->ns) of the document-element is correct; check if the declared namespaces (doc->node->nsDef) are correct. - Check if you have correctly built a schema at all; there might be a chance that you validate with an empty schema. 1) xmlSchemaNewParserCtxt(), xmlSchemaNewDocParserCtxt(), ... 2) xmlSchemaParse() 3) xmlSchemaNewValidCtxt() 4) xmlSchemaValidateDoc() Regards, Kasimier _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
