Re: [xml] attach a local catalog



On Mon, Sep 02, 2002 at 01:59:06PM -0400, Michael Rothwell wrote:
Daniel Veillard wrote:


 > parser.c:    ctxt->catalogs = xmlCatalogAddLocal(ctxt->catalogs, URL);
 > you will have to do something similar (i.e. add the catalog 
programmatically
 > to the parsing context).

Yes, I want a per-document catalog. The context for this request is a 
threaded server managing different sets of documents. I would like for 
<xsl:include href="http://me/include.xsl"/> or <xsl:include 
href="local://include.xsl"/> to look for include.xsl in the thread's set 
of documents only, not in some generic set, or in the wrong set.

Using the xmlCatalogAddLocal() function, I'll need to write a file out, 
and then pass in a URL so that it can be read back in. What I really 
need to do is have a per-document catalog with a specific rewrite rule 
in it. I can pass in a URL to read a blank catalog, that's fine; but I'd 
like to be able to add items to the catalog without putting them in a 
text file and reading them in by specifyign a URL to that text file. In 
other words, I'd like to have a function to add a rule to the local 
catalog. It would also be nice to be able to add a catalog without 
needing to pass in a URL; for instance, by passing in an xmldocptr ... I 
will not always be able to write files to disk, so having a method for 
defning local uri rewrite rules for a document programmatically will be 
useful.

  Then catalog are not what you should use. Define your own entity
loader. Read http://xmlsoft.org/xmlio.html and follow the entity loader
example. You will need to keep track of the parsing context you're creating
to use the right set (and make your code thread safe) but that should work.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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