[xml] setting URL for xmlRelaxNGParserCtxt?



Hi there,

In my lxml Python binding for libxml2, I was using the following approach to construct a Relax NG schemas:

xmlDocPtr* doc = ...
parser_ctxt = xmlRelaxNGNewDocParserCtxt(doc)

unfortunately, this got me into trouble with Relax NG schemas that use the 'include' statement. They try to load the files to be included, but have no idea where to look, as this information is lost.

Glancing through the source, it seems like the only way to make the 'include' statement work is to use xmlRelaxNGNewParserCtxt, which takes a URL.

Would it be useful to have a way to supply this URL to an existing xmlRelaxNGParserCtxtPtr? Something like:

void xmlRelaxNGSetURL(xmlRelaxNGNParserCtxtPtr* ctxt, const char* URL)

Even more powerful, though decidedly more tricky, would be a way to hook into the lookup process itself. If my XML is sitting in an object database for instance, the current approach would fail, unless I expose all relevant XML objects under a URL and refer to that.

I imagine the same issues come up when using XSLT that tries to include or import external stylesheets.

Regards,

Martijn



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