[XML-SIG] Re: [4suite] External entities question

Uche Ogbuji uche.ogbuji@fourthought.com
Wed, 19 Dec 2001 08:10:25 -0700


S=E9bastien Pierre wrote:
>=20
> Hi folks, I guess you are quite busy with the december release, but...
>=20
> I have a two questions regarding 4DOM and 4XSLT, the first one
> being simple, the second one slightly more complicated ;)
>=20
> Here is the first one:
>    How can I set entity resolvers in DOM builders and
>    is there any xmlproc-like catalog files support?

Hmm.  The framework Dieter Maurer added to pDomlette for this never
seems to have been ported to 4DOM.  Let me try to get a chance to port
it and I'll let you know.


> And the slightly more complicated one:
>    I have an XML input file that has entities that I want to
>    be expanded in a different way depending on the XSLT stylesheet.
>    This means that entities expansion should be done not while
>    parsing the input, but actually made by the XSLT processor using
>    entity definitions found in the XSLT stylesheet. I have put so
>    far the entities inside a DOCTYPE stylesheet declaration, which
>    may not be a wise choice.

Hmm.  I'm a bit fuzzy on this.  Is the main need to parse the input
once, and then apply different entity defs to the DOM for different
processing runs?  This would be very difficult.  If so, have you
considered using XInclude and driving the include resulution from the
stylesheet rather than the parser?

If all you mean is that you'd like to register a different entity
resolver for parsing input documents, then this should be easy using
cDomlette or pDomlette.  Unfortunately, it wasn't until just now because
I forgot to add a hook to change the cDomlette entity resolver.  Now it
conforms to Dieter's interface for pDomlette.  You can create a
cDomlette reader as follows:

rdr =3D cDomlette.RawExpatReader(resolveEntity=3Dfoo)

where foo is a callable object that takes base, pubid and sysid and
returns a resolved URI.


--=20
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com=20
4735 East Walnut St, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management