GNOME Bugzilla – Bug 312216
Please wrap support for XML Schemas and Relax NG
Last modified: 2008-12-12 12:09:30 UTC
the API is exposed in - include/libxml/relaxng.h and - include/libxml/xmlschemas.h - (Daniel Veillard just replied to the mailing list thread (http://sourceforge.net/mailarchive/forum.php?thread_id=7863484&forum_id=12784) and announced his work on xml schematron - no idea how that works, but the API seems to be similar, so here goes: include/libxml/schematron.h) judging the code, where I used relax ng, i think it's most important to wrap - the structures *ParserCtxtPtr, *ValidCtxtPtr, *Ptr - *NewParserCtxt(), *Parse(), *FreeParserCtxt(), *NewParserCtxt(), *NewValidCtxt(), *ValidateDoc(), *FreeValidCtxt() - xmlReadFile should be there already, right?
Thanks. Committed. However, Gtk::Combo is deprecated, and it's far more important that we update that section to mention Gtk::ComboBox.
Ignore the last comment: wrong bug. I'm pretty sure that we already use most of those functions. We hide the context (Ctxt) inside the *Parser instance. Maybe the *ValidCtxt is something new.
Reopening. Didn't meant to close it.
concerning comment 2, I don't think that's correct: daniel@bert:~/1/libxml++2.6-2.10.0$ grep -ir relax * | cut -d: -f1 daniel@bert:~/1/libxml++2.6-2.10.0$ grep -ir schema * | cut -d: -f1 docs/reference/2.10/html/classxmlpp_1_1TextReader.html docs/reference/2.10/html/classxmlpp_1_1TextReader.html docs/reference/Doxyfile.in docs/reference/Doxyfile libxml++/parsers/textreader.h daniel@bert:~/1/libxml++2.6-2.10.0$ lixml++/parsers/textreader.h just has this comment: /** Whether an Attribute node was generated from the default value defined in the DTD or schema.
Please use the gnome milestone field only to indicate gnome-wide showstoppers. Thanks.
marking as new
> concerning comment 2, I don't think that's correct: > > daniel@bert:~/1/libxml++2.6-2.10.0$ grep -ir relax * | cut -d: -f1 > daniel@bert:~/1/libxml++2.6-2.10.0$ grep -ir schema * | cut -d: -f1 But you mentioned this API: > *ParserCtxtPtr, *ValidCtxtPtr, *Ptr > *NewParserCtxt(), *Parse(), *FreeParserCtxt(), *NewParserCtxt(), > *NewValidCtxt(), *ValidateDoc(), *FreeValidCtxt() Mabe we need to know what * is. Sorry for being pedantic, but I think precision is useful when dealing with the obscure libxml API.
This is still unclear to me. I'd like an actual list of libxml functions that we don't wrap, please, ideally not containing functions that we do wrap. Examples of their use would be even better.
Created attachment 89401 [details] [review] Patch to add schema This is a patch to add XML schema validation capability to libxml++. This patch is only tested on linux. As I have not any other platform, I cant add files to projects other than autotools. Regards Emilien
Created attachment 89706 [details] [review] libxmlpp_schema.patch This is a svn diff version of the patch, so that it doesn't include changes to generated files. It still needs a ChangeLog entry. I have not yet looked at the patch properly.
Note that my revised patch is missing the schema.h and schema.cc files from the original patch.
Ok cool. Thanks to generate it, I dont work on svn tree.
So, will this patch be added to libxml++? (In reply to comment #10) > Created an attachment (id=89706) [edit] > libxmlpp_schema.patch > > This is a svn diff version of the patch, so that it doesn't include changes to > generated files. It still needs a ChangeLog entry. > > I have not yet looked at the patch properly. >
I didn't like that this seems to be a separate class rather than just support for schemas in the regular parsers, but I see that the API is the same as our existing DtdValidator class. I guess that is used to validate a document with a DTD other than the one mentioned in the document. But is this new class the only way to validate with a Schema instead of a DTD, or does it also work if you just mention the Schema in the document?
I have applied this in svn trunk and I will soon do a libxml++ 2.23.1 tarball release. Sorry for the delay, Emilien. Without the ChangeLog entry it wasn't clear to me until recently.
Hi, I'd reop this bug, if I know how to do that. There are some problems with the schema wrapper. 1st: xmlSchemaFree is used nowhere, though xmlSchemaParser is used ->mem leak 2nd: in schema.cc, release_underlying method: impl_ = 0 -> really bad! 3rd: embedded_doc_ variable will never be true, so in release_underlying nothing will be freed, deleted, etc. 4th: in schema.cc, set_document: the embbed parameter is never used.
That sounds rather bad. Could you try to make a patch, please?
Sorry, but I do not have the time to investigate this further, though the patch should be straightforward as soon as someone finds out what embbeded_doc_ is really used for. This patch resolves the mem leak problem in the case where set_document is not used (which is exactly the case what I am using it for) (though if set_document is used, it still won't be freed because of the embbeded_doc_ is always false problem) --- a/libxml++/schema.cc +++ b/libxml++/schema.cc void Schema::release_underlying() { + if (impl_) + xmlSchemaFree(impl_); +
Created attachment 124025 [details] [review] libxml++_schemafree.patch I have committed this patch, which is what I think you are suggesting. I would appreciate it if someone could test that this fixes the problem.
Created attachment 124504 [details] [review] schema.cc patch There is a little bug in schema.cc and libxml++ won't build. This patch fixes that.
Thanks. Committed.