Re: Catalog resolution?
Karl Waclawek <[email protected]> Mon, 29 Mar 2010 10:32:07 -0400
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
On 28/03/2010 5:37 PM, Jeremy H. Griffith wrote: > > I'm currently using expat to parse DITA documents by > using XML_SetExternalEntityRefHandler to look at the > system identifier, create a reference to a local dir, > and parse it using XML_ExternalEntityParserCreate. > (Shorthand version; I can post the code if necessary.) > > Now we need to support specializations, some of which > use XML Catalogs. I don't see a catalog resolver in > expat; am I missing something? Any ideas on how to > add catalog resolution without using Java or any GPL > software? My understanding is that a catalog simply maps public or system ids to locally reachable URIs. So, you can still use the external entity resolver (as you described above), and within that resolver you perform the mapping. Sometime before you start parsing, you need to load the catalog into a hash table, for instance, by parsing it like any XML document. The code should be very simple and boilerplate - and that is probably why nobody has created a public library for it. You should be able to create a re-usable module for it yourself. Karl