[xml] Including in RNG and XSD doesn't propagate parse options and _private


we had a report on the lxml mailing list that including subschemas in XML
Schema and RelaxNG does not propagate the application context, which helps us
in dealing with things like Python-level document resolvers. lxml handles this
through the _private pointer in the xmlParserCtxt (mainly when parsing), as
well as the _private pointer in an xmlDoc (e.g. in XSLT). This was also a
problem in XInclude, where it has been partially fixed in 2.6.29 (although not
in a way that helps us), but now we hit a similar problem with schemas.

The problem is different in both schema implementations. RelaxNG is worst as
xmlRelaxNGLoadInclude() simply calls xmlReadFile(URL, NULL, 0), so there is
currently no way to propagate any context.

In xmlschema.c, the function xmlSchemaAddSchemaDoc() already creates a new
parser context and then calls xmlCtxtReadFile() with it. However, it does not
pass on any hint about the source document or the original parser context.

I'm not quite sure how to fix this, especially without adding a new API to
libxml2. I can't currently oversee the implementation, but it looks like
parsing and preparing the schemas are separate steps, which would make support
for in-context schema parsing more difficult. Any ideas?


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