Hi Steve, Entities must always be declared somewhere in the DTD. Your EntityResolver only gets an opportunity to resolve the external ones (e.g. <!ENTITY foo SYSTEM "http://abc.def.ghi">). It is possible to inject an external subset programmatically (see EntityResolver2.getExternalSubset [1]) with a similar effect to what you're currently doing directly with the stream. That's probably the best you can do.
Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ext/EntityResolver2.html#getExternalSubset (java.lang.String,%20java.lang.String) Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Steve Ebersole <steven.ebers...@gmail.com> wrote on 06/18/2009 09:11:48 AM: > Does xerces provide a *pluggable* mechanism to tell the parser the > replacement text to use when it encounters an entity reference? > > The specific use case is attempting to control values used in docbook > sources. So say you have: > <book> > <bookinfo> > ... > <releaseinfo>&version;</releaseinfo> > <pubdate>&today;</pubdate> > </bookinfo> > </book> > > I would like to "inject" the replacement values for the '&version;' and > '&today;' entity references. Currently I do this by injecting doctype > "internal subset" <!ENTITY ...> defs in the stream used by the parser. > What I'd much rather be able to do is to register something akin to an > EntityResolver that resolves the replacement text. > > -- > Steve Ebersole <st...@hibernate.org> > Hibernate.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org