Re: [xml] setting URL for xmlRelaxNGParserCtxt?

On Tue, Jan 25, 2005 at 08:14:22PM +0100, Martijn Faassen wrote:
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.

   Wrong. How did you built "doc" ?  If it's from a memory string you can
still define the base for that document by providing the URL argument
of xmlReadMemory().

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

  no the base has to be set in the document. Since that part is just
described by '...' in your mail there is little more indications I can

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

  The base is a property of the document, not of the relax-NG transformation
compilation, this is really the wrong approach.

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

  yes the base is *in* the document.
  xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri)
to be called on your document. But it should really be there as the result
of parsing.


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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