Re: [xml] Validating using IO parser context
- From: Daniel Veillard <veillard redhat com>
- To: "Henke, Markus" <Markus_Henke ordat com>
- Cc: "'xml gnome org'" <xml gnome org>
- Subject: Re: [xml] Validating using IO parser context
- Date: Thu, 30 Aug 2001 07:10:47 -0400
On Thu, Aug 30, 2001 at 12:00:16PM +0200, Henke, Markus wrote:
Hello out there,
again one more try. Maybe i was sketchy explaining my problem b4.
No
It's clear (thank you, Daniel) that i've to provide an base-URI, since there
is none specified in an IOParserContext
created with a filedescriptor and the DTD is linked by an RELATIV
URI-reference (...SYSTEM "someDTD.dtd").
It's also clear (at least i guess so) that my externalEntityLoader has to
compute the path to the DTD.
Right, basically, there is nothing in the XML document which allows
to make this computation. So you are doing something which is not directly
supported by the XML specification as such, and can't expect standard
XML tools to handle it natively.
So, you need to write your own entity loader and put some logic
there to allow the recognition of your specific need.
The question is HOW can i provide the base URI in a way that the
externalEntityLoader can acces it?
I don't know any easy way ... if you use
xmlCreateIOParserCtxt()
then you can probably add this information to the ioctx parameter.
The externalEntityLoader runs in a parserContext provided by it's signatur
static xmlParserInputPtr myEntityLoader(const char *URL, const char *ID,
xmlParserCtxtPtr ctxt)
but that's NOT the context 'origParserCtxt' of the XML-Document
Have you tried using the _private field of the parser context ?
http://bugzilla.gnome.org/show_bug.cgi?id=54322
Have you tried using the directory field of the parser context ?
Yes, getting access to the parser context means you will have to use lower
level APIs probably.
Have you tried using a catalog too to redirect the given system ID
to another one ?
So, again the question:
Is there a way in libxml to provide a base URL to a XML document so that an
externalEntityLoader can access it?
Directly I can't tell, maybe there is no infrastructure for it.
Maybe you can but since what you're doing is really specific it's not
surprizing it may not be easy to do in a general framework.
You must accept the fact that doing something which is not directly
supported from the XML standard may be harder to implement. Making
an URI reference where there is an implicit base but it's not provided
in the document context is clearly pushing the limit.
I don't think it's impossible. But it will definitely take you
more work to get working.
That said if you require extensions I may provide them, or fix code
if there is problems.
Daniel
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
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]